Add Activity to device table (1344 Views)
Reply
Honored Contributor
Piku
Posts: 3,683
Registered: ‎06-17-2010
Message 1 of 11 (1,344 Views)
Accepted Solution

Add Activity to device table

Hi All,

I am trying to add activity to device table according to knowledge document as in below thread.But activities are not adding to activity table.I am using activitydevice table to log the activities for device.

I have seen lots of thread on forum and from document itself, it says that sc.activity RAD(use to add activity to table) is OOB called if se.base.method is called. But it is not happening.

Then I tried to add sc.activity in corresponding DO and FC as per below thread and document but no luck.
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1443183

Also from RAD debugger trace it seems that no activity table found in object record when calling the RAD(RAD: sc.activity in panel decide.use.module).But I already defined it.


Any help will be appreciated.


Regards,
Tushar


Please use plain text.
Honored Contributor
Piku
Posts: 3,683
Registered: ‎06-17-2010
Message 2 of 11 (1,344 Views)

Re: Add Activity to device table


Any one have some clue on this..
I am using SMv7.03


Regards,
Piku
Please use plain text.
Honored Contributor
Piku
Posts: 3,683
Registered: ‎06-17-2010
Message 3 of 11 (1,344 Views)

Re: Add Activity to device table

Hi,

Any one please.



Thanks,
Please use plain text.
Honored Contributor
Carol Hibbard
Posts: 878
Registered: ‎03-16-2000
Message 4 of 11 (1,344 Views)

Re: Add Activity to device table

If you want to audit changes to CI values in the device (and related join tables), see the attached document.
Please use plain text.
Honored Contributor
Piku
Posts: 3,683
Registered: ‎06-17-2010
Message 5 of 11 (1,344 Views)

Re: Add Activity to device table

Hi Carol,

Thanks for your wonderful document.It worked as stated.

But I am facing a problem, since in our we usually change the logical name also so audit history will not be visible in that case.
Do you have any solution to this issue?Does device table have any other unique number or field?
It means I would not be able to see audit history if I will change unique field value(becoz only logical name is unique filed in device table to identify device record)



However I am still looking for the solution to my actual problem i.e. why activity are not logging in activitydevice table.



Thanks,



Please use plain text.
Valued Contributor
BeginnerHPSM
Posts: 297
Registered: ‎12-07-2009
Message 6 of 11 (1,344 Views)

Re: Add Activity to device table

Hi Piku,.


Can you tell me how r u trying to store the activity in activitydevice table. I mean what all things u have done in order to store activity into the activitydevice table.
Please use plain text.
Honored Contributor
Piku
Posts: 3,683
Registered: ‎06-17-2010
Message 7 of 11 (1,344 Views)

Re: Add Activity to device table

I have done as follow
1) dbdict "activitydevice" created
2) created "activitydevice" form with file name "activitydevice" (Note: in your link, the file name of "activitychange" is "cm3r". Is it rather "activitychange" file instead of "cm3r"?)
3) created "activitydevice" in number file
4) "activitydevice" in notebook tab "Activities" of device Object (Document Engine)
5) Added the following two actions: (in "activityaction"/device table)
1. Name:Open
Condition:$L.mode="add"
Description:{"Device " + logical.name in $L.file + "added"}

2. Name: Update Activities
Table: device
Mode: update
Condition: $L.mode="update"
Details:
Name: Change Status
Condition: not same(istatus in $L.file,istatus in $L.file.save)
Description: {"State of the device changed from" + istatus in $L.file.save + "to" + istatus in $L.file}

6) Added "activitydevice.pre.add" trigger in device table.

I also called the sc.activity application with the parameters you mentioned in the link (cm3r being replaced by device).


Now, when I change the status of a device, nothing is written to activitydevice table. It does not work.

as in follow thread
http://www.sc-resources.net/threads/2533-Device-activity-(history)-in-SC6?highlight=activitydevice

I also tried to call sc.activity in device FC
and in DO of save but no success at all.



Thanks,
Please use plain text.
Valued Contributor
BeginnerHPSM
Posts: 297
Registered: ‎12-07-2009
Message 8 of 11 (1,344 Views)

Re: Add Activity to device table

Hi Piku,

I had similar kind of requirement for OCML. I did with the help of javascript.

function create_activity2(nameTabAct,itemNo,typeAct,descAct,visible)
{

var now = new Date();
var future = new Date(2199,12,31,17);
var delta = future -now - (30*86400000);
var days = String(parseInt(delta/86400000));
var hours = String(parseInt((delta - (days*86400000))/3600000));
var minutes = String(parseInt((delta - (days*86400000) - (hours*3600000))/60000));
var seconds = String(parseInt((delta - (days*86400000) - (hours*3600000) - (minutes*60000) )/1000));
var negdatestamp = new XMLDate( "P"+days+"DT"+hours+"H"+minutes+"M"+seconds+"S");


var fAct = new SCFile(nameTabAct);
fAct.type = typeAct;
fAct.description = new Array(descAct);
fAct.number=itemNo;
fAct.datestamp=system.functions.tod();
fAct.negdatestamp=negdatestamp.getDatum();
fAct.operator=vars.$lo_user_name;
fAct.cust_visible=visible;
var rc = fAct.doSave();
if ( rc == RC_SUCCESS )
{
//print("Activity Created "+typeAct);
return true;
}
else
{
print("Création of activity is not possible.");
return false;
}
}

Call this script from the fc of device table.
Please use plain text.
Honored Contributor
Piku
Posts: 3,683
Registered: ‎06-17-2010
Message 9 of 11 (1,344 Views)

Re: Add Activity to device table

Hi Beginner@HPSM,

Thanks for your script and idea.
But I am just trying to figure out why the activity are not generating.In tried to use JS as last workaround to implement if no OOB functionality is available or not working.
Here I want to ask one thing that 2199,12,31,17 is using for what.


Thanks,
Please use plain text.
Honored Contributor
Carol Hibbard
Posts: 878
Registered: ‎03-16-2000
Message 10 of 11 (1,344 Views)

Re: Add Activity to device table

It was my understanding that activities didn't support the device table due to its virtual join structures. However, I am not positive about this.
Please use plain text.
Honored Contributor
Piku
Posts: 3,683
Registered: ‎06-17-2010
Message 11 of 11 (1,331 Views)

Re: Add Activity to device table

Hi Carol,

Yes it seems to be due to joinfile but it is working for the some one else as mentioned in other thread.and this is the thing making me confused.

I am still waiting for positive reply from some one who had successfully implemented the same.


Thanks,
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation