Issue with save in OnLoad Client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2017 07:22 AM
Hi All,
There is a catalog Item which has Date variable, while user selecting the date as 04-06-2016, its changes into 0007-08-06. And it's not consistent. To get the rid of this problem I have created another variable as single line text and copy the value of user's selection on Date field and paste it there. Which is working fine.
And onLoad of that Requested Item, I am placing it back to Date Variable. The problem is that whenever user open the RITM page, the date field gets changed and if user navigate to other page then it asking to save that page.Therefore, I have applied g_form.save() line.
I would like this to be happen only once. Below is the line of code however save is going on loop and i want to execute only once.
Could anyone of you please let me know how do i restrict the save to execute only once?
Quick reply must be appreciated.
function onLoad() {
var required_date = g_form.getValue('variables.u_date');
if (required_date != '') {
var boolea = true;
if(bool)
{
g_form.setValue('variables.u_req_date',required_date);
g_form.setDisplay('variables.u_date', false);
g_form.save();
boolea = false;
return;
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2017 08:39 AM
Any Update or help, where & what is going wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2017 08:57 AM
I would not do this and instead look into why it changing it to 0007-08-06. Seems to be a bigger issue here since date fields isn't suppose to work like that. Let me know if that is something you want to do and I can help you some with trouble shooting.
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2017 11:04 AM
Hi GN
I agree with Göran. You need to understand the reason behind the issue with the date.
Probably it's a proper platform bug and probably requires a ticket to be opened...
On the other hand, I would suggest to check the following points before opening an incident in HI
- Is this issue related with all date variables used for the service catalog items ?
- In case this issue is affecting only a specific item. is there any script automatically inserting the date ? Sometimes this kind of side effects are related with the date format of the data provided.
- Did you check if this is issue is affecting all the date format a user can use in the system or only specific ones ?
Regards
R0b0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2017 11:12 AM
Hi GN
Other things you can test are the following..
- Is the issue happening when a user use the date picker ONLY ?
- Is the issue happening when a user provide the date manually ONLY ?
- Is the issue happening on both cases (date picker and manual date insert ) ?
- Is the issue affecting the main UI ?
- Is the issue affecting the service portal ?