Transform Script to bulk update Install Status and Operational Status of asset

Bijay Kumar Sha
Giga Guru

Hi,

I've a requirement to bulk update Install Status and Operational Status of Assets. I've a Data Source and corresponding onbefore Transform script where I need to do the bulk update. 

Please note that Operational Status is depending upon Installation Status and both fields are mandatory. 

Let me provide you the Choice List values for both the fields-

1. If Install Status is 'Installed' (1), then corresponding Operational Status values are Live (105), Pending Repair (106), Pending Return (112)

2. If Install Status is 'In Stock' (6), then corresponding Operational Status values are Available (100), Pending Repair (106).

 

These values is being provided in an excel sheet by the user. 

How I can write the script to do the bulk update? Please help me on this. 

7 REPLIES 7

manjusha_
Kilo Sage

@Bijay Kumar Sha 

 

Does field Operational Status has choices on target table or not?

Thanks,

Manjusha 

Hi @manjusha_ As I mentioned in my description, Yes Operational Status has choices on the target table and the choices are depending upon the choices of 'install_status' field. I've provided the corresponding Field name and values as well. 

@Bijay Kumar Sha 

 

If you have choices for Operational Status then from transform map you can just update field install status only .

You have to create a ui policy on target table to show choices based on install status field .

No need to write the script in transform map.

You can just specify mapping for install status field in transform map

 

For operational status field -you have given multiple choices ,if there is specific choice need to be set based on install status ,you need to write script in onbefore script.

 

 

 

 

var install_status =source.status//please check correct backend name from source table 
if(install_status=='Installed'){
   target.operation_status = 'Live'; //Replace assigned_to with any reference field
}
else if(install_status=='In Stock'){

target.operation_status = 'Available'; //please use correct backend name for field and choices 
}

 

 

 

 
If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact

Thanks,

Manjusha Bangale

 

Hi @manjusha_  as i mentioned there are 2 choices for 'Install Status' field and there are few choices for 'Operational Status' field and the choices of 'Operational Status' field are depending upon the choices values of 'Install Status' field. and both the fields are mandatory. 

1. If Install Status is 'Installed' (1), then corresponding Operational Status values are Live (105), Pending Repair (106), Pending Return (112)

2. If Install Status is 'In Stock' (6), then corresponding Operational Status values are Available
(100), Pending Repair (106).

So, if a user is providing the 'Install Status' value as 'Installed' then he has to Provide a valid value for Operational Status as he'll have only 3 options to choose which are Live (105), Pending Repair (106), Pending Return (112). He can choose any one of these 3. If he write any other value in the excel sheet, then bulk update should be terminate. 

 

Hope I'm clear.