web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Update field on button click

(0) ShareShare
ReportReport
Posted on by 35

Hi,

I created a custom button in ribbon workbench, unfortunately its not working when i click the button, nothing happens.

The weird thing is, I created also other buttons and they all work fine on click, I also used the command checker and everything seems correct.

This is the code in the command:

function OnGetSetResubmitButtonClick(primaryControl)
{
    var formContext = primaryControl;

    // Set value
    formContext.getAttribute("skt_updateddetailsbyops").setValue(true);
       
    // Alert new value
    formContext.getAttribute("skt_updateddetailsbyops").getValue();
    alert("Ticket was successfully resubmitted");
     

}

And this is the code for the enable rule:

function ResubmitEnable(primaryControl) {
try {
debugger;
var formContext = primaryControl;
var isShowResubmit = false; // Show/Hide Variable for "Resubmit " Button
 
//Get active process details
var activeProcess = formContext.data.process.getActiveProcess();
var getActiveProcessName = activeProcess.getName();
 
//Get active Stage details
var activeStage = formContext.data.process.getActiveStage();
var getactivestagename = activeStage.getName();
 
var state = formContext.getAttribute("statecode").getValue();
 
//If ticket is already Resolved then return false
if (state !== 0) // 0 = Open
{
return isShowResubmit;
}
 
//Check the BPF stage name
if (activeProcess != null && getActiveProcessName == "Ticket | Process") {
 
if (getactivestagename === "Ticket Request") {
isShowResubmit = true;
}
 
}
return isShowResubmit;
} catch (e) {
alert("An error has occurred : " + e.message)
 
}
 
}

pastedimage1684236023523v1.png

pastedimage1684236087011v2.pngpastedimage1684236132858v3.png    

pastedimage1684236296414v4.png

I have the same question (0)
  • Suggested answer
    Manoj Mane Profile Picture
    1,020 on at
    RE: Update field on button click

    Hi smar.sus,

    Can you please try below steps to diagnose issue:- 

    1. Can you please check by adding the alert at very first line of your function. 
    2. Try to publish all customization.
    3. Clear your browser cache and check. 

    Thanks,

    Manoj Mane.
    Please mark this as VERIFIED if it helps. image

  • smar.sus Profile Picture
    35 on at
    RE: Update field on button click

    Thank you Manoj Mane !

    But it still doesn't work. The weird thing is, it worked one time a few days ago and then it stopped. I created another button with another web resource and it works. I also deleted the web resource for this button and created it new, but still nothing.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 159

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 152

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 134 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans