Need help on client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 08:54 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 10:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 10:46 PM
console.log will not work in client script. Please replace it with an alert or with g_form.addInfoMessage() and see the inputs you are getting.
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 10:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 11:00 PM
Are you getting the variable values in the info message ? If yes, try adding some more info messages in the script to see the point of failure.
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 11:51 PM
Hi @nameisnani
Your final solution is , first go to maintain item and search for your catalog item and at the bottom of page check the correct variables value and noted down for your client script and then inside catalog client scripts create 2 onchange catalog client scripts. one for function field and other for Action field.
1. Client script Onchange Field = Function
2. Client Script Onchange Field = Action
var v1 = g_form.getValue('function'); //use backend value of function variable
var v2 = g_form.getValue('action'); // use backend value of action variable
// use value for FMCODE and ADD of choices
if(v1 == 'fmcode' && v2 == 'add') {
// Hide two fields and unhide one
g_form.setVisible('report_description', false);
g_form.setVisible('description', false);
g_form.setVisible('value_change', true);
}
else if(v1 == 'fmcode' && v2 == 'add') {
// Hide two fields and unhide one
g_form.setVisible('report_description', false);
g_form.setVisible('description', false);
g_form.setVisible('value_change', false);
}
else {
g_form.setVisible('report_description', true);
g_form.setVisible('description', true);
g_form.setVisible('value_change', false);
}