Need help on client script

nameisnani
Mega Sage

HI Team , 

 

I want to fulfill the custom conditions through client script . 

 

can anyone please provide me client script for my requirement .

 

we have catalog called ' XYZ ' 

 

We have a field ' FUNCTION' with below values 

FMCODE

FMCP

FMGRM

FMMENU

Other

 

Field

Action:
Add
Update
Delete

 

 

 Total variables 

 

1. Requested For
2. Line Manager
3. Short description
4. Request Type (drop down)
5. Company Code (tick box multi-selection)
6. Function (drop down)
7. Action (drop down)
8. Code Type (free text)
9. Code (free text)
10. Description (free text)
11. Report Description (free text)
12. Execution Date & Time (calendar selection)
13. Business Justification (free text)

 

Custom conditions
a) If function is FMGRM, and action is add, then the "code type" and "report description" fields are not there, and an extra free text field called "Value Change" is under the Description field.
b) If function is FMMENU, and action is add, then the "code type" and "report description" fields are not there

 

 

I want to fulfill the custom conditions through client script .

 

NOTE - Here we can use UI Plocy , there some conflicts in the UI pocly , that why i want to achieve this via cilent script .

 

can any one please provide correct script for this .

 

Thanks in advance  

17 REPLIES 17

@nameisnani 

For time being remove those two fields fro UI policy and apply alert message on functionField and actionField  to check the value you getting.

 

 

Amit Verma
Kilo Patron
Kilo Patron

@nameisnani 

 

Did you tried debugging the client script with some log statements or alerts ? Please validate that the drop-down internal values are correct (For Label FMGRM -> Value is fmgrm and so on).

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Hi @Amit Verma @Maddysunil 

 

Yes i have checked , label everything is correct only .

Deepak Shaerma
Kilo Sage
Kilo Sage

Hi @nameisnani 
create a onchange catalog client script, for function variable . and add 1 line on Amit verma script to check the script execution 

 

console.log("Script executed. Function: " + g_form.getValue('function') + ", Action: " + g_form.getValue('action'));

    var functionField = g_form.getValue('function');
    var actionField = g_form.getValue('action');

 


If you are facing issues, check your proper variable names and modify it in code as well.
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards 
Deepak Sharma


nameisnani
Mega Sage

hi @Deepak Shaerma @Amit Verma @Maddysunil 

nameisnani_0-1712725621591.png

 

nameisnani_1-1712725647323.png

 

 

still not working idk why