so, for example, if jay is assigned to workflow group 2 (WG2) than that resource cannot be added to workflow group 3 (WG3)
So in the Screenshot below i have added jay to be part of (WG3) but jay was initially added to (WG 2)
when user tries to save this they should get an error saying jay belongs to a wg2
I was told to use a javascript web resource to achieve this. This is the javascript i have got so far and it is triggering on save even of the form.
var formContext = executionContext.getFormContext();
// Get the selected Resource and Workflow Group values
var resourceId = formContext.getAttribute("icando_resource").getValue();
var workflowGroupId = formContext
.getAttribute("icando_workflowgroup")
.getValue();
<fetch mapping='logical'>
<entity name='icando_clientresourceallocation'>
<attribute name='icando_resource'/>
<attribute name='icando_workflowgroup'/>
<filter type='and'>
<condition attribute='icando_resource' operator='eq' value='`+resourceId[0].id+`'/>
</filter>
</entity>
</fetch>`;
Xrm.WebApi.retrieveMultipleRecords("icando_clientresourceallocation", fetchXml).then(
function success(result) {
for (var i = 0; i < result.entities.length; i++) {
console.log(result.entities[i]);
}
// perform additional operations on retrieved records
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
i am getting a scripting error for any resource i save. How can i do proper validation so that when a resource is added to a wrong workflow group users gets an error.


Report
All responses (
Answers (