Update CI version Automatically


I want to update the CI version automatically when we close a release record 

the naming convention will be like displayName_Location_Date, this will be from cm3r table to device file .


any help to do this  ?


Top Replies

  • 0  

    Release record is change record (cm3r) - Right ?

    The new value must be inserted into device table, in what field ?

    Then you need to use triggers for cm3r table (after change)

    set condition for status and if it become close (or any you use) set in device table any changes you whant.

  • 0   in reply to ALARMus

    hi  ALARMus,

     yes it is cm3r record.

    we want the version field to be sum of (CIName_CIType_Vx 1)

    how we can collect all this one field ?

  • 0   in reply to Nadeen

    See my previous post (i fixed some script line)

    What do you mean "appropriate application for this trigger" ?

    If this is for change then cm3r. Fix your new script in trigger.

    And dont forget to compile it.

  • 0   in reply to ALARMus

    Hi ALARMus ,

    i did it using FC and i could combine 3 values (fields) toghether thank you.

    and my issue now that i cant update the CM with the version value .

    could you help me please how i can pass this value to device table ?

  • 0   in reply to Nadeen

    Describe more details what you have now (table, field, value) ?

    What condition when you whant to start transfer some data to what table and what field ?


    KUDOS are Welcome

  • 0   in reply to ALARMus

    Hi ALARMus,

    i want to transfer a customized field in "cm3r" table named as "releaseversion " when i close the change record of category "Release Management " to the  "version' field in the "Device" Table .

    i want a query which always update the version value from the release record for this CI

    source                         Destination 

    release version            version

    cm3r                             device

    condition : cm3r status is closed 


  • 0   in reply to Nadeen

    what name of field in cm3r table wich contain value of logical.name for table device ?

  • 0   in reply to ALARMus

    Hi  ALARMus

    its name is "assets "

  • 0   in reply to Nadeen

    Trigger for cm3r table  (after update), name it like cm3r.a.u.Add2Device

    if (!system.functions.same(record.status,oldrecord.status) && record.status=="Closed")
    	var TableDevice = new SCFile("device");
    	if (TableDevice.doSelect("logical.name=\"" record.asset "\"") == RC_SUCCESS)
            TableDevice.version= record.releaseversion

    That's mean if the change status is changed and equel "Closed"

    Then update Device table with data from cm3r table.

  • 0   in reply to ALARMus

    Hi ALARMus  ,

    it gives me this error:

    Script <no name>  line 1: ERROR SyntaxError: invalid assignment left-hand side at char 76

    if (!system.functions.same(record.status,oldrecord.status) && record.status="Closed")


    Compilation of JavaScript function or expression failed



  • 0   in reply to Nadeen


    see script again.

  • 0   in reply to ALARMus

     ALARMus  ,

    unfortunately it is not working ! 

Reply Children
  • 0   in reply to Nadeen

    So. what exactly dont work ?


  • 0   in reply to ALARMus

    the compiltation is successful but the version value is not being changed after closing the change 

    i added the trigger with script in cm3r table as attached

  • 0   in reply to Nadeen

    So let's make some troubleshooting.

    Change part of your script to:


    TableDevice.version = record.rc_version } }


  • 0   in reply to ALARMus

    thanks  ALARMus,

    still the script not updating the device file after closing the record

  • 0   in reply to Nadeen

    lets fix it.

    1) So let's define what fields you use

    Source                         Destination 

    table: cm3r-------------device


    rc.version ------------> version ?

    asset ========== display.name ?

    ci.rc =========== display.name ?


     Do you need for this trigger start application = trigger.device.mtbf (as i see on your screenshot) ?

     2) About script. Lit's add some print:

    if (!system.functions.same(record.status,oldrecord.status) && record.status=="Closed")
    	print("(1) - cm3r.a.u.Add2Device: Status changed to Closed for Change-" record.number);
    	var TableDevice = new SCFile("device");
    	if (TableDevice.doSelect("display.name=\"" record.ci_rc "\"") == RC_SUCCESS)
    		print("(2) - cm3r.a.u.Add2Device: Found CI with display.name = " record.ci_rc "; Updating Device, set - " record.rc_version);
            	TableDevice.version= record.rc_version;


    3) And finally display you FC for this version in cm3r (where you add concatenation for version)

  • 0   in reply to Nadeen

    Please answer questions to continue resolving your problem.