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 ?
Cybersecurity
DevOps Cloud
IT Operations Cloud
If an answer to your question is correct, click on "Verify Answer" under the "More" button. The answer will now appear with a checkmark. Please be sure to always mark answers that resolve your issue as verified. Your fellow Community members will appreciate it!  Learn more
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.
No its not a filed they are 3 fields !
but when we update the version of a CI the new version (version field in device table ) should contain those 3 three information .
my question is : how we can gather three fields in one field as a text ?
So. You can use FC and script (as trigger)
FC:
In Calculations for calculation line:
Use field of table or temporary variable (for example - $L.Version)
$L.Version="Some text if need - " field1 in $file ", Some more fixed text if need; " field2 in $file
Well now just transfer this $L.Version where you need.
*****************
Or You can use Triggers :
if (!system.functions.same(record.status,oldrecord.status) && record.status=="Closed") { var TableDevice = new SCFile("device"); if (TableDevice.doSelect("logical.name=\"" record.number "\"") == RC_SUCCESS) { TableDevice.version= record.YOURFIELD1 "_" record.YOURFIELD2 "_" record.YOURFIELD3 } }
If this trigger for CM3R table so - record.YOURFIELD1 - field from cm3r table and
record.number field in CM3R table wich contained logical.name value
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.
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
lets fix it.
1) So let's define what fields you use
Source Destination
table: cm3r-------------device
=========fields=========
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)
lets fix it.
1) So let's define what fields you use
Source Destination
table: cm3r-------------device
=========fields=========
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)