本文介绍了通过URL运行自动化脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Maximo 7.6.1.1:

Maximo 7.6.1.1:

我想通过在单独的系统中调用URL来运行Maximo自动化脚本.

I want to run a Maximo automation script by invoking a URL in a separate system.

有可能这样做吗?

推荐答案

这是一个很好的用例,最近几天我们一直在努力.

This is a great use-case and something that we've been working through in the last few days.

  1. 创建自动化脚本.-我的名字叫Automation_api_test
  2. 使用浏览器通过API手动调用它,以确保您可以实际运行它.(%servername%/maximo/oslc/script/automation_api_test?var1 = 1212321232& var2 = 1555& site = OPS& _lid = wilson& _lpwd = wilson)
  3. 像编写常规自动化脚本一样编写脚本.这是一个可以从URL读取一些参数并使用它们在核心系统中执行操作的参数.

  1. Create automation script. - mine is called automation_api_test
  2. Manually invoke it through the API using a browser to make sure that you can actually get it to run. (%servername%/maximo/oslc/script/automation_api_test?var1=1212321232&var2=1555&site=OPS&_lid=wilson&_lpwd=wilson)
  3. Script it like you would your regular automation script. Here's one that can read in a few parameters from the URL and use those to perform operations in the core system.

importPackage(Packages.psdi.server);
importPackage(Packages.psdi.util.logging);

var resp = {};
// Get the Site ID from the Query Parameters
//var site = request.getQueryParam("site");

var var1 = request.getQueryParam("var1");
var var2 = request.getQueryParam("var2");
var site = request.getQueryParam("site");
//var zxqponum = request.getQueryParam("ponum");

//logger.debug(zxqprinter);
service.log("TESTING script Params" + request.getQueryParams());
service.log("var1 " + request.getQueryParam("var1"));
service.log("var2 " + request.getQueryParam("var2"));

//count the number of WO's in the site
var woset = MXServer.getMXServer().getMboSet("WORKORDER", request.getUserInfo());
woset.setQbe("SITEID","="+site);
var woCount = woset.count();
resp.wo_count = woCount;
woset.close();

// Get Total Count
resp.total = woCount;
//create the response - still not sure why I had to append the vars to a string.

resp.var1= "" + var1;
resp.var2= "" + var2;
resp.site= "" + site;

var responseBody = JSON.stringify(resp);

这篇关于通过URL运行自动化脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:44