UI Macro in Client Script..

Sriraj V
Tera Contributor

Hi All,

How to get the value of an ui macro in client script?

We have an UI macro in a record producer, based upon the ui macro value I need to restrict form submission.

 

I tried using g_form.getValue('ui_macro'), it didn't give me value. Is there any other way to get the value for UI macro.

Kindly Suggest

 

Regards,

Sri

 

3 REPLIES 3

Riya Verma
Kilo Sage
Kilo Sage

Hi @Sriraj V ,

 

Hope you are doing great.

Try using gel function to fetch UI macro id.
reference code:

function restrictFormSubmission() {
  var uiMacroElement = gel('ui_macro_id');
  var uiMacroValue = uiMacroElement.value;

  if (uiMacroValue === 'restricted_value') {
    // Perform actions to restrict form submission
    alert('Form submission restricted based on UI macro value.');
    return false; // Cancels form submission
  }

  return true; // Allow form submission
}

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Hi @Riya Verma ,

 

This is that oob ui macro - "std_chg_glide_list_change_requests"

SrirajV_0-1685979134586.png

which is used in the oob record producer - "Propose a new Standard Change Template"

 

My client script is,

SrirajV_1-1685979233034.png

This script is not working. Whether my macro id which i used in client script is wrong.? Kindly advise

M_48
Tera Contributor

Could you find a solution? Because I have a similar problem. Kindly suggest