logo
down
shadow

Maximo JS automation script: "importPackage" is not defined


Maximo JS automation script: "importPackage" is not defined

By : user3100718
Date : January 12 2021, 09:11 PM
I hope this helps you . I'm attempting to use a JS script from Maximo 76 Scripting Features (PDF download). , Add this to the beginning of the script:
code :
load("nashorn:mozilla_compat.js");


Share : facebook icon twitter icon
Maximo Automation Script for Integration

Maximo Automation Script for Integration


By : Amalia T
Date : March 29 2020, 07:55 AM
seems to work fine I really need help, I can't seem to find an answer to this. What I want to happen is during the inbound of data from the xml to the system, the PRNUM will be queried to the PRLINE object (which is the child object of the PR) so that I can get the CONTRACTNUM field, but I cant seem to get a value from it. I always get an error of Nonetype because its empty. , So after a lot of trial and errors here's what worked
code :
from psdi.server import MXServer
def beforeCreateMboSet(ctx):
    mbo = ctx.getMbo()
    struc = ctx.getData()
    try:
        contractSet = MXServer.getMXServer().getMboSet('CONTRACT', ctx.getUserInfo())
        prLine = struc.getChildrenData('PRLINE')
        prCount = len(prLine)
        count = 0
        while count < prCount:
            struc.setAsCurrent(prLine,count)
            contractNum = struc.getCurrentData('CONTRACTNUM')
            contractSet.setWhere("CONTRACTNUM = '"+contractNum+"'")
            contractRec = contractSet.moveFirst()
            struc.setCurrentData('CONTRACTID',contractRec.getString('CONTRACTID'))
            count += 1
    finally:
        contractSet.close()
Maximo automation script get user securityGroup

Maximo automation script get user securityGroup


By : good_job
Date : March 29 2020, 07:55 AM
This might help you There are some implicit variables available to you in an automation script (check the IBM Automation Script guide), one of which is the current user's username. There is also the :&USERNAME& special bind variable that gets replaced with the current username. You can use one of those as part of the query to fetch a GroupUser MBO and then check the count of it afterward.
I'm going off of memory here so the exact names and syntax probably differ, but something like:
code :
groupUserSet = MXServer.getMXServer().getMboSet("GROUPUSER", MXServer.getMXServer().getSystemUserInfo())
groupUserSet.setWhere("userid = :&USERNAME& and groupname in ('MAXADMIN', 'USERUSER')")
# Not really needed.
groupUserSet.reset()

if groupUserSet.count() > 0:
    # The current user is in one of the relevant groups.
else:
    # The current user is not in one of the relevant groups.
groupUserSet.close()
permissionsSet = MXServer.getMXServer().getMboSet("APPLICATIONAUTH", MXServer.getMXServer().getSystemUserInfo())
permissionsSet.setWhere("optionname = 'CANCOMPPERM' and groupname in (select groupname from groupuser where userid = :&USERNAME& )")
# Not really needed.
permissionsSet.reset()

if permissionsSet.count() > 0:
    # The current user has the necessary permission.
else:
    # The current user does not have the necessary permission.
permissionsSet.close()
Unable to fetch the second mbo for poline using automation script in maximo

Unable to fetch the second mbo for poline using automation script in maximo


By : user1634620
Date : March 29 2020, 07:55 AM
hope this fix your issue I assume your "po.add(2L)" line is running in this test? The "add" method adds the new MBO to the beginning of the MBO set, thereby pushing your original first MBO into the second slot, and the original second MBO into the third slot. That means that when your loop starts over and gets MBO 2, you get what's newly in the second slot, meaning the first MBO. Your loop ends before it reaches the new-third slot (where the next MBO you want has moved to) because you constructed your condition to only do up to the original count. In fact, since it processed that first MBO again, it would have added a second MBO to the set, pushing your originally-first MBO into the third slot. So if your loop was set up to keep going, you would just keep adding new MBOs and keep pushing that same first MBO on to the next processing slot indefinitely.
What you probably want in this case is "addAtEnd()" (and to keep your loop as-is). Alternatively you can use the MBO set iterating methods of .moveFirst() and .moveNext(). I think that will keep you advancing through the set even if you add records behind or at the current position.
Fetch System Property in Automation script in Maximo

Fetch System Property in Automation script in Maximo


By : ssmagin
Date : March 29 2020, 07:55 AM
Hope this helps MXServer has 2 getProperty() methods. To get a public property's value, just pass in the name of the property. To get a private property's value, you'll also need to pass in a UserInfo.
Example in Jython:
code :
from psdi.server import MXServer
maximo = MXServer.getMXServer()
publicProperty = maximo.getProperty("company.public.propertyname")
privateProperty = maximo.getProperty("company.private.propertyname",mbo.getUserInfo())
Can Automation Script in Maximo replace Maximo's bean class?

Can Automation Script in Maximo replace Maximo's bean class?


By : oneye
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Automation Scripts run on the "server side" (see Note 1), so you cannot use them instead of beans. However, you may be able to hook a button on the dialog to an Action associated with an Action Launch Point on an Automation Script and have that script do the copying. The catch is that you can't have the script close the dialog or do other UI things like bringing up the "longop" indicator / spinny wheel.
A good warning when getting into Automation Scripting is to be careful to not think the only way to do things in Maximo is with Automation Scripting. It is super tempting when holding the Automation Scripting hammer to think of all problems as nails, but sometimes a hammer isn't the right tool for the job. For example, a crossover domain may solve the problem you are facing and would perform better and be more supportable than a customization / automation script. (Yes. Generally speaking, you should consider automation scripts to be UNsupportable customizations, not supportable and upgradeable configurations.)
Related Posts Related Posts :
  • redux how to use state
  • All data in the db is lost when closing a express based node js server
  • How to convert javascript code for Angular
  • XPath select on child nodes
  • Idle event on mouse move - how to stop script permanently on mouse move
  • Why do I get logic is not defined in this code
  • When I enter a number in the input, the first function starts
  • ES6 imports and node_modules hell
  • How to get css selector of clicked-on element?
  • How to auto input MySQL data (input column 1 data to auto input column 2 data with same column) in php?
  • Appending to Datalist Via Javascript
  • Customizing Material-UI Components with Styled-Components
  • Populate elements with class name using Javascript
  • How to execute promises in batches (first resolving 10, then next 10 and so on)
  • How to surround selected text inside textarea with <em> on key combination CTRL+i?
  • Your configured registry does not support audit requests ~ On npm audit
  • What's the Angular equivalent of Vue <slot/>?
  • Iconify icon not updating when "data-icon" set with setAttribute()
  • Javascript newbie stuck with XMLHttpRequest return data
  • How to add obj to to state in my example Redux React
  • Loading "grunt-karma.js" tasks...ERROR >> SyntaxError: Unexpected identifier
  • Why do I get log is not defined
  • get the multiple index of the same string
  • How can I iterate over an Array object by using For IN or FOR OF
  • Launch local executable from web browser
  • How to prepare array of json objects to d3 hierarchical tree structure
  • VueJS - event emitted - show HTML before other calculations
  • Export SASS/SCSS variables to Javascript without exporting them to CSS
  • How to attach an event handler only once continuously
  • How to make button open a link in new tab in JavaScript?
  • Find range from the javascript object
  • How can I use my jQuery code as JavaScript?
  • How to show 5 images in a 2 row slider with bxslider
  • How to convert stream into variables in typescript
  • Three.js custom shader error on Chrome GL_INVALID_OPERATION: Active draw buffers with missing fragment shader outputs
  • My JavaScript doesn't work. How can I solve this problem?
  • Why is this async function is running synchronously?
  • Get updated variable from within react hook before return
  • I want to show all image preview but whenever I upload a new one the old one is gone
  • Would I be able to give access to specific electron APIs safely?
  • Why several clicks fire for each instance of a Class?
  • cant grab value from div using attr()
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org