Clear/cancel auto populated 'Requested_for' field

Sue143
Tera Expert

Hy Guys,

I am having a bit of trouble to figure how to clear the value of a field 'requested for' type in the form. The problem is that this Item is under the Technical catalog and does not appears in ServicePortal, so an UI policy have not helped me so far.

what I have it does clean the value:

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.clearValue('adm_account');
}

but also, it Clears any other value I may set. 

I have tried onload function but it hasn't work.

 

Is anybody there whiling to help? 🙂 

 

Appreciate any help,

 

thank you.

5 REPLIES 5

Jaspal Singh
Mega Patron
Mega Patron

Bit confused. If I understand correctly you have a variable with default value that you wish to override? OR something else.

Script above looks fine.

Also, 'The problem is that this Item is under the Technical catalog and does not appears in ServicePortal' Can you elaborate bit more on it.

Hi @Jaspal Singh . I have a variable type 'requested for' named 'adm_account'. This type of variable is always auto populated with the logged in user when you load the form. (not my configuration, it seems the behaviour of ServiceNow for this variable type).

Anyway, this should not be the case, and I would like to load the form with this variable value empty, so the user has to enter the correct account (in this case is most likely not to be the logged in user).

The problem is that an UI policy did not helped me. And the script I have works, but I would like something to work 'on load' no 'on change' because as soon as the request is loaded the field should be empty.

 

BR,

 

Suellen. 

SumanthDosapati
Mega Sage
Mega Sage

Hi,

Your requirement is not clear.

If you want to clear requested for field then in the script why are you clearing adm_account field.

And when should you clear the field based on any other field or onload you need to clear default value.

How is service portal and technical catalog related to this.

 

Regards,
Sumanth

Hi @Sumanth Dosapati I have a field type 'requested for' on the Catalog Item from and the name of it is 'adm_account'.

In the ServicePortal, a simple UI policy would solve my issue. But in the technical catalog the catalog items are only available in the back end not in ServicePortal, therefore I need to script it.