Highlighted
Super Contributor.
Super Contributor.
280 views

Is it possible to set field when click button link new record?

Hi Everyone,

 

I have SM 9.40 along with Windows Server 2k8

I have one field in incidents table let say, "escalated". I want to set field "escalated" to "true" when user click button "Link new record". I have checked the display option for that buttons and I see the diplay option, action is "Open" not save. Is it possible to set field for display option with action "open"?

Does anyone have any ideas? Highly appreciated for who help me.

Best Regards,

Okik

0 Likes
5 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Is it possible to set field when click button link new record?

hello,

You can set IO action for changing that field to the needed value after escalation is done.

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Is it possible to set field when click button link new record?

Hello Vadim,

 

Thanks for the reply, would you please let me know or give me some examples for set IO action?

 

Best Regards,

Okik

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Is it possible to set field when click button link new record?

There should ne OOB ioactions for setting correct statuses fpr linked records.

 

You can check sl Interoperobilityrecords

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Is it possible to set field when click button link new record?

Hi Vadim,

 

Yes I have found IO in SL, would you please let me know which part i can change to set the value to true for that field?

function doScheduleAction( record, action, expiration )
{
// This function will schedule an interoperability action to be performed
// against the record that is passed in.

var myRecord = record;
var schedule = new SCFile("schedule");
schedule._class = "linker";

if ( expiration != null )
schedule.expiration = expiration;
else
{
var time = new Date();
schedule.expiration = time;
}
schedule.name = "Interoperability Record";
schedule.application = "ioevents.process";

var dTag = new Datum();
system.functions.tag(dTag, record);

schedule.strings[0] = dTag;
schedule.strings1[0] = action;

if ( schedule.doInsert() == RC_SUCCESS)
{

return true;
}

return false;
}

function scheduleAction( record, action )
{

var time = new Date();
return doScheduleAction( record, action, time );

}

function rescheduleAction( record, action )
{
var time=new Date();

var sched = new Date(time.getTime() + 120*1000);

return doScheduleAction( record, action, sched );

}


function doDeleteAction(problemId){
var sql = "source=\"" + problemId + "\" and source.filename=\"rootcause\" and depend.filename=\"problem\"";

var iTotal= new SCDatum();
var returnCode = 0;
var relation = new SCFile("screlation");

system.functions.rtecall("count", returnCode, relation, sql, iTotal);
var count = parseInt(iTotal.getText());

var problem = new SCFile("rootcause");
if ( problem.doSelect("id=\"" + problemId + "\"" ) == RC_SUCCESS ){
if ( count != problem.incident_count ){
problem.incident_count = count;
var result = problem.doAction("updatecount");
if ( result != RC_SUCCESS){
if ( result == RC_CANT_HAVE || result == 51 ){
var returnCode = system.library.interoperabilityHelpers.rescheduleAction( relation, "PM.open.incidents");
}
}
};

};
}

//QCCRIE74727-When an screlation is deleted between a problem and a known error, the parent.problem is not cleaned up
function updateKnownError(problemId){

var knownerror = new SCFile("knownerror");

var rc = knownerror.doSelect("parent.problem=\""+problemId+"\"");
if (rc==RC_SUCCESS)
{

var ret;
system.functions.rtecall("trigger", ret, 0);
do
{
knownerror.parent_problem='';
var rc= knownerror.doUpdate();

}
while( knownerror.getNext() == RC_SUCCESS);
system.functions.rtecall("trigger", ret, 1);

}

}
//QCCRIE74727-associate knownerror with problem
function updateParentProbleminKnownError(problemId,knownErrorId){

var knownerror = new SCFile("knownerror");

var rc = knownerror.doSelect("id=\""+knownErrorId+"\"");
if (rc==RC_SUCCESS)
{

var ret;
system.functions.rtecall("trigger", ret, 0);
if (knownerror.parent_problem==null)
{
do
{
knownerror.parent_problem=problemId;
var rc= knownerror.doUpdate();

}
while( knownerror.getNext() == RC_SUCCESS);
}
system.functions.rtecall("trigger", ret, 1);

}

}

function shceduleDeleteAction(problemId){

var schedule = new SCFile("schedule");
schedule._class = "linker";

var time=new Date();
var sched = new Date(time.getTime() + 60*1000);
schedule.expiration = sched;

schedule.name = "Interoperability Record";
schedule.javascript=
"var id = \""+problemId+"\";\r\n" +
"var returnCode = system.library.interoperabilityHelpers.doDeleteAction(id)";

if ( schedule.doInsert() == RC_SUCCESS)
{

return true;
}



return false;
}

 

 

Best Regards,

Okik Setianto

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Is it possible to set field when click button link new record?

This Script from SL used for make Schedule - you should not change anything there.

To set some value in cerrently opened record there is some standart method.

Triggers->Schedule->IOAction-> Ok or ReSchedule

So first at all you need use trigger for ADD in Probsummary table.

1) Triggers must make schedule (using script wich you display here)

2) Schedule start IOAction

3) IOAction set value in record (set to true in interaction in your case) - if save successfully(if interaction still blocked - opened by someone) then ReSchedule this Schedule again.

 

So you need create some new IOAction (and make a script there) and from 2) call IOAction with this created name.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.