- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2022 07:29 AM
Thanks Nikita can you please me with other issue as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2022 07:56 AM
Hello Rishabh,
This is happening because you have I believe 3 UI policies and hence they are conflicting with each other. I would suggest you to create a single UI policy with the below condition:
Condtion: Job responsibility is one of Task, Duties, Responsibilities, All
In Execute if true: Please replace the correct field name and field Values (like All, Task, Duties backend value)
var jobResponsibility = g_form.getValue("job_responsibility");
if (jobResponsibilty == "All") {
g_form.setDisplay("task_entry", true);
g_form.setDisplay("duties_entry", true);
g_form.setDisplay("responsibilities_entry", true);
g_form.setMandatory("task_entry", true);
g_form.setMandatory("duties_entry", true);
g_form.setMandatory("responsibilities_entry", true);
} else if (jobResponsibility == "Task") {
// While hiding the fields you first need to set Mandatory as false and then set Display as false;
g_form.setMandatory("duties_entry", false);
g_form.setMandatory("responsibilities_entry", false);
g_form.setDisplay("duties_entry", false);
g_form.setDisplay("responsibilities_entry", false);
g_form.setDisplay("task_entry", true);
g_form.setMandatory("task_entry", true);
} else if (jobResponsibility == "Duties") {
// While hiding the fields you first need to set Mandatory as false and then set Display as false;
g_form.setMandatory("task_entry", false);
g_form.setMandatory("responsibilities_entry", false);
g_form.setDisplay("task_entry", false);
g_form.setDisplay("responsibilities_entry", false);
g_form.setDisplay("duties_entry", true);
g_form.setMandatory("duties_entry", true);
} else if (jobResponsibility == "Responsibilities") {
// While hiding the fields you first need to set Mandatory as false and then set Display as false;
g_form.setMandatory("task_entry", false);
g_form.setMandatory("duties_entry", false);
g_form.setDisplay("task_entry", false);
g_form.setDisplay("duties_entry", false);
g_form.setDisplay("responsibilities_entry", true);
g_form.setMandatory("responsibilities_entry", true);
}
in Execute if false:
g_form.setMandatory("task_entry", false);
g_form.setMandatory("duties_entry", false);
g_form.setMandatory("responsibilities_entry", false);
g_form.setDisplay("task_entry", false);
g_form.setDisplay("duties_entry", false);
g_form.setDisplay("responsibilities_entry", false);
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2022 08:08 AM
OR else I believe you can achieve this using UI policy actions as well with below conditions in UI policy. you can create 3 UI Policies with details mentioned below:
Keep
On load : checked (on all UI Policies)
Reverse if false : checked (on all UI Policies)
1. UI policy for Task:
Condition - Job Responsibilities IS Task OR ALL
In UI policy actions - Task entry : mandatory - true, visible - true
2. UI policy for Duties:
Condition - Job Responsibilities IS Duties OR ALL
In UI policy actions - Duties entry: mandatory - true, visible - true
3. UI policy for Responsibilities:
Condition - Job Responsibilities IS Responsibilities OR ALL
In UI policy actions - Responsibilities entry: mandatory - true, visible - true
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2022 09:39 AM
*Execute if True-
function onCondition() {
var jobResponsibility = g_form.getValue("job_responsibilities");
if (jobResponsibilty == '4') { // Value for Choice 'All' is 4
g_form.setDisplay("task_entry", true);
g_form.setDisplay("duties_entry", true);
g_form.setDisplay("responsibilities_entry", true);
g_form.setMandatory("task_entry", true);
g_form.setMandatory("duties_entry", true);
g_form.setMandatory("responsibilities_entry", true);
} else if (jobResponsibility == '1') { // Value for Choice 'Task' is 1
// While hiding the fields you first need to set Mandatory as false and then set Display as false;
g_form.setMandatory("duties_entry", false);
g_form.setMandatory("responsibilities_entry", false);
g_form.setDisplay("duties_entry", false);
g_form.setDisplay("responsibilities_entry", false);
g_form.setDisplay("task_entry", true);
g_form.setMandatory("task_entry", true);
} else if (jobResponsibility == '3') { // Value for Choice 'Duties' is 3
// While hiding the fields you first need to set Mandatory as false and then set Display as false;
g_form.setMandatory("task_entry", false);
g_form.setMandatory("responsibilities_entry", false);
g_form.setDisplay("task_entry", false);
g_form.setDisplay("responsibilities_entry", false);
g_form.setDisplay("duties_entry", true);
g_form.setMandatory("duties_entry", true);
} else if (jobResponsibility == '2') { // Value for Choice 'Responsibilities' is 2
// While hiding the fields you first need to set Mandatory as false and then set Display as false;
g_form.setMandatory("task_entry", false);
g_form.setMandatory("duties_entry", false);
g_form.setDisplay("task_entry", false);
g_form.setDisplay("duties_entry", false);
g_form.setDisplay("responsibilities_entry", true);
g_form.setMandatory("responsibilities_entry", true);
}
}
*Execute if False-
function onCondition() {
g_form.setMandatory("task_entry", false);
g_form.setMandatory("duties_entry", false);
g_form.setMandatory("responsibilities_entry", false);
g_form.setDisplay("task_entry", false);
g_form.setDisplay("duties_entry", false);
g_form.setDisplay("responsibilities_entry", false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2022 07:59 AM
Hi,
I would suggest to add UI policy actions instead of scripts in UI policy. disable the existing UI polices you have written.
You have to write 3 UI policies for this as follows:
UI policy 1:
Condition - Job Responsibilities IS Task
UI policy action - Task entry : mandatory - true, visible - true
UI policy 2:
Condition - Job Responsibilities IS Duties
UI policy action - Duties entry: mandatory - true, visible - true
UI policy 3:
Condition - Job Responsibilities IS Responsibilities
UI policy action - Responsibilities entry: mandatory - true, visible - true
Try this as let me know the results!
Thanks,
Sagar Pagar