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.)
Comments
Post a Comment