Client script (cell edit) in List not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2017 11:17 PM
Below is Client script wrote for type: on cell edit.
If old value is not 27(Delivered to client) and change to new state 27 then it should allow only if manager review met is 'Yes'. For testing purpose i add alerts after
if (oldValue !=27), if (newValue==27) and before var managerreview, script is not running after if (newValue==27). I checked the field name it is correct. This is not working on list view.
function onCellEdit(sysIDs, table, oldValues, newValue, callback)
{
var saveAndClose =false;
for (var i = 0; i < oldValues.length; i++)
{
var oldValue = oldValues[i];
if (oldValue !=27)
{
if (newValue==27)
{
var managerreview = g_form.getDisplayValue('u_manager_review_met');
if (managerreview=='Yes')
{
saveAndClose = true;
}
}
}
}
if(saveAndClose == false)
{
alert("This State change is Not Allowed.");
}
//Type appropriate comment here, and begin script below
callback(saveAndClose);
}
Thanks in advance..
- Labels:
-
Problem Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 12:26 AM
Hi Suryan,
May I know why do you need to check the oldvalues of state? The client script needs to be triggered only if anyone tries to change the state to 27 with a manger view yes. If these two conditions dont match it should show an alert.
Please let me know if my understating is correct.
Regards,
Souren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 12:31 AM
Hi,
I just checking if he tries to move to same state i dont want to run the code so am checking if(!oldstate). - its ok we can remove that code.
change the state to 27 - > get value from field if manager review is yes , if yes then allow to change which is saveandclose == true.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 01:11 AM
Hi Suryan,
How are you using g_form in onCellEdit client script.
Its work on list view not on form view, resulting will not get value of field "u_manager_review_met".
Regards,
Runjay