Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
ACUSER Respected Contributor.
Respected Contributor.
2023 views

Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

I am trying to create a simple warning message when someone tries to set the assignment of an asset record to retired while it still has residual value remaining. I created a workflow, based on the portfolio table that is triggerred when residual value > 0 with an action script  that provides the message and then a terminal event. When I use Err.Raise() it will pop-up an error message just fine, but of course, they cannot continue to make the modification. So I tried amMsgBox, but I either not using it correctly, or it won't work for this? (It does not pop-up a window with my message in it.)

 

Here is the script as it is now;

dim lErr as long
dim strErr as string
 
lErr = amGetRecordFromMainId("amPortfolio", [lPortfolioItemId])
if [seAssignment] = 2 then
strErr = amMsgBox("This asset has remaining value left on it.",1)
end if

 

Does anyone have any ideas for me?

0 Likes
1 Solution

Accepted Solutions
ACUSER Respected Contributor.
Respected Contributor.

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

The only reason I thought this would be a common thing, was this is a process issue, not a database normalization issue. They are not invalid records, we just want to warn people if they are retiring a device that still has value on it, they should have a good reason to go ahead and retire it anyway (such as a damaged device.) That is why I wanted them to have the option to accept the responsibility and retire it anyway. In any case I did get a good idea from HP support. I created an action script, then associated it to the modify button. (Shown Below.) BTW - do you still get points for awnsering? I cannot see how to apply points to this thing.

 

1. Create a script type action with amPortfolio as its context table. Write script like the following:
------------------------
Dim lErr As Long
If [seAssignment] = 2 and [Asset.mNetValue] <> 0 Then
' Display a pop up with OK and Cancel button
lErr = amMsgBox("The portfolio item is Retired but the Residual value of the asset is not $0. Click Cancel button to cancel the modification of the record.", 1)
End if

'If Cancel button was clicked,
If lErr = 12001 Then
Err.Raise(-2009, "The asset could not be modified since it is retired and residual value is not $0")
End if
------------------------

2. In Application Designer, go to the portfolio item screen.

3. Under the Buttons tab, find "Modify" button. In the "Associated action" column, type in:
A:<SQL Name of your action script created in step 1>

4. Click Modify and save the structure change in Application Designer.

5. Log back into AM client and test.

Please note that this is only valid for modifications done via the Modify button on the portfolio screen. If the record is modified through another methods such as wizards or any other scripts etc, the pop up will not come up. You might also want to add a similar script to the Modify button of amAsset screens as well.

 

Thanks for you suggestions.

View solution in original post

0 Likes
15 Replies
Highlighted
Absent Member.. MTWalsh Absent Member..
Absent Member..

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

You could maybe launch a super simple wizard with your workflow maybe.

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

use the table validity script attribute with the logic from action script.  the amMsgBox() will work there.  obviously the amMsgBox() doesn't work during workflow execution.  no need to raise an error either.

0 Likes
ACUSER Respected Contributor.
Respected Contributor.

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

I tried to add a wizard to my workflow, but when I retire an asset record with residual value, I get the following error - "Cannot execute action 'UpdateAssignmentToRetired'. Wizard type actions are not authorized in non-interactive mode". It looks like you cannot fire a wizard directly from a workflow?

0 Likes
ACUSER Respected Contributor.
Respected Contributor.

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

I tried this, but it works essentially the same as the action script. If I include a amMsgBox, it does nothing, if I include an Err.Raise command it does not let me make the modification to retired.

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

not directly but through a user action type workflow activity.

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

use the error raise function in the validity script attribute but end with RetVal = TRUE.

ACUSER Respected Contributor.
Respected Contributor.

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

I tried the RetVal = FALSE with the valididty script, but all it did was change the error message a little. It looked more like an informational message, instead of a full-out error message (with the little red icons.) But it still would not let me modify the record. I may have to force them to use a wizard to reitre stuff. I have also opened a ticket with HP support. There initial response was they did not think that it could be done, but they will research. I will post back here if they have a solution that works. (Seems to me like it might be a common thing that other people would want to have.) Thanks for your help.

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

Place the logic in the readonly attribute of any field, of table in question, and make sure the end result of your logic matches the existing readonly value (Yes or No).

 

BTW, this is not a common thing; usually the requirement would be NOT to let them perform a task in conflict if it really is in conflict.

0 Likes
ACUSER Respected Contributor.
Respected Contributor.

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

The only reason I thought this would be a common thing, was this is a process issue, not a database normalization issue. They are not invalid records, we just want to warn people if they are retiring a device that still has value on it, they should have a good reason to go ahead and retire it anyway (such as a damaged device.) That is why I wanted them to have the option to accept the responsibility and retire it anyway. In any case I did get a good idea from HP support. I created an action script, then associated it to the modify button. (Shown Below.) BTW - do you still get points for awnsering? I cannot see how to apply points to this thing.

 

1. Create a script type action with amPortfolio as its context table. Write script like the following:
------------------------
Dim lErr As Long
If [seAssignment] = 2 and [Asset.mNetValue] <> 0 Then
' Display a pop up with OK and Cancel button
lErr = amMsgBox("The portfolio item is Retired but the Residual value of the asset is not $0. Click Cancel button to cancel the modification of the record.", 1)
End if

'If Cancel button was clicked,
If lErr = 12001 Then
Err.Raise(-2009, "The asset could not be modified since it is retired and residual value is not $0")
End if
------------------------

2. In Application Designer, go to the portfolio item screen.

3. Under the Buttons tab, find "Modify" button. In the "Associated action" column, type in:
A:<SQL Name of your action script created in step 1>

4. Click Modify and save the structure change in Application Designer.

5. Log back into AM client and test.

Please note that this is only valid for modifications done via the Modify button on the portfolio screen. If the record is modified through another methods such as wizards or any other scripts etc, the pop up will not come up. You might also want to add a similar script to the Modify button of amAsset screens as well.

 

Thanks for you suggestions.

View solution in original post

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

Glad to see your issue is resolved.  I am not sure how to assign points however I wonder if clicking the Kudos section of thread will work.

 

No worries.  Hopefully I was helpful.

ACUSER Respected Contributor.
Respected Contributor.

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution
You were definately helpful - gave me some new ideas to think about. Thanks again.
0 Likes
Sigmarr
Visitor.

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

Hi!

I have the same problem that you had.

I tried this solution and it works but only for one position change. When I change a few position in the same time, it causes the error "action cannot be completed: actions cannot be performed when changing multiple record selection".

I have no idea what to do with this. Maybe you solved it?

Thanks

0 Likes
Acclaimed Contributor.. Mark Cullen_1 Acclaimed Contributor..
Acclaimed Contributor..

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

Depending on the solution you implemented, you could convert to use [CurrentSelection] and loop through each value for determination.  See help for [CurrentSelection], but in essence this stores the primary key values of each selected record, separated by commas.  This can be used even for one selected record.  Use ExtractValue() function to parse for each primary key.

0 Likes
Sigmarr
Visitor.

Re: Create a simple warning message in Asset Manager when changing a particular value

Jump to solution

I don't understand how to use [CurrentSelection] and ExtractValue(), when system blocks any actions associated with button "Modify"

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.