2

I'm working on a project. I want to get the name of web resource e.g if I want to get entity name I use this query

var entityName = parent.Xrm.Page.data.entity.getEntityName();
var id = parent.Xrm.Page.data.entity.getId();

so in the same way how I can get the web resource name at this time, I am passing the web resource as a string.

getImages(entityName, id, "WebResource_webTest");

So can you tell me how i can get the web resoucre name.

1 Answer 1

2

Here is the code snippet I just tried on one of my Entity and it gave me webresource name

You can add this function on load on change and pass execution context as parameter to function

Note: If you have 5 webresources on your form you will get one by one all the webresource names. you can tweak/modify code as per your need.

function onChangeOfField(executionContext) {
    debugger
    var formContext = executionContext.getFormContext();
 formContext.ui.controls.forEach(function(control, index) {
            var controlType = control.getControlType();
            if (controlType === "webresource" ) {
               alert(control.getName());
            }               
    });
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.