- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 07:11 AM
I have a script that sets the value from another field on the form but it seems to be adding extra characters to the end.
The client script is read the Parent Agreement number and setting it in the field information:
The highlighted field should be showing the exact value from the Parent Agreement field but it adds -J001.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 10:39 AM
Hello @polodre2
Please give a try to the script below and see how it works for you.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var choiceoption = g_form.getValue('u_art_4_2_1_dp1_fin_obl');
var getNameValue = g_form.getDisplayValue('u_parent_agreement');
if (choiceoption == 'No Cost Option') {
var message = 'ARL CRADA + (' + getNameValue + ') Article 5.2.1, "No Cost Option" has been chosen for technical efforts under this JWS';
g_form.showFieldMsg('u_art_4_2_1_dp1_fin_obl', message, 'info');
g_form.addInfoMessage(message);
} else if (choiceoption == 'Payment to ARL Option') {
var message = 'ARL CRADA + (' + getNameValue + ') Article 5.2.2, "Payment to ARL Option" has been chosen for technical efforts under this JWS';
g_form.showFieldMsg('u_art_4_2_1_dp1_fin_obl', message, 'info');
g_form.addInfoMessage(message);
}
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 07:41 AM
Hi @polodre2,
I think it is taking extra value as you are using getDisplayValue('field_name'). Can you try it with getValue('field_name') method?
var getNameValue = g_form.getValue('field_name');
If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 07:50 AM
I used getDisplayValue because getValue was returning the sysID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 08:00 AM - edited 02-02-2024 08:01 AM
Hello Polodre2,
What is the variable type for Parent Agreement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 10:17 AM
Parent Agreement is a reference field