How to quickly update an attibute from a browser bookmark

Andreas CieslikDyn365CE2 years ago14 Views

 As a developer or tester sometimes its really nice to have a direct way to update an attribute on the current record.

To accomplish that you can simply bookmark a new page in e.g. Chrome and add this little piece of JavaScript into the URL field:

javascript:(function(){const curId=Xrm.Page.data.entity.getId();const entName=Xrm.Page.data.entity.getEntityName();const fldName = window.prompt(“Please enter the attribute name”);const fldValue = window.prompt(“Please enter the attribute value”);const jsdata={};jsdata[fldName]=fldValue;Xrm.WebApi.updateRecord(entName, curId.replace(/[{}]/g, ”), jsdata).then(function success(result) {window.alert(‘${entName} was successfully updated’);},function (error){window.alert(error.message);});})()

An alert box will ask you for the internal attribute name and a second for the value.
This might not be the best way to do it but it will give you a clue on how to change it for your own needs.

(This script will only work for simple field types e.g. integer, string, etc.)

Original Post https://code2life.blogspot.com/2022/04/how-to-quickly-update-attibute-from.html

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
March 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       
« Feb   Apr »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...