Hi,
I need to hide and show assign button on the case entity, if the value of stage from the other entity (hide and show button) is equal to the stage of case entity using js.
I have also written a code, it gives me an alert when stages of both entity is equal but doesn't hide and show button using return true or false.
Any kind of help will be appreciated.
function Can(PrimaryControl)
{
debugger;
var formContext = PrimaryControl;
var stage=formContext.getAttribute("ss_stage").getValue();
var status=formContext.getAttribute("ss_casestatus").getValue();
if(stage!=null)
{
Xrm.WebApi.online.retrieveMultipleRecords("ss_showhidebutton", "?$select=ss_buttonname,ss_role,ss_showhidebuttonid,ss_stage,ss_status").then(
function success(results) {
for (var i = 0; i < results.entities.length; i++) {
var ss_buttonname = results.entities[i]["ss_buttonname"];
var ss_role = results.entities[i]["ss_role"];
var ss_role_formatted = results.entities[i]["ss_role@OData.Community.Display.V1.FormattedValue"];
var ss_showhidebuttonid = results.entities[i]["ss_showhidebuttonid"];
var ss_stage = results.entities[i]["ss_stage"];
var ss_stage_formatted = results.entities[i]["ss_stage@OData.Community.Display.V1.FormattedValue"];
var ss_status = results.entities[i]["ss_status"];
var ss_status_formatted = results.entities[i]["ss_status@OData.Community.Display.V1.FormattedValue"];
if(stage==ss_stage)
{
return true;
}
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
else
{
return false;
}
}