IBM Support

Code to Avoid Looping while calling User Exit

Troubleshooting


Problem

Code to Avoid Looping while calling User Exit

Symptom

PART: Agents 4.0 SP3 Platform
COMPONENT: UserExit
OS: <None> - All Supported
DATABASE: <None> - All supported
WEB SERVER: <None> - Weblogic
WEB BROWSER: Internet Explorer - 5.5 sp2

Cause

Resolving The Problem

In Yantra, sometimes through certain events or user exits, there is possibility of looping. this has to be avoided specifically through adding a particular piece of code in the java class file.

For example with DoOrderPricing user exit implemented for createOrder.0005 . internally, changeOrder is being called, which in turn calls DoOrderPricing user exit again.

the sample code to be added is given below:

YCPInternalContext ycp = (YCPInternalContext)env;
Map userObj = (Map)ycp.getUserObject();
if(userObj == null)
{
userObj = new HashMap();
userObj.put("CALLED","Y");
ycp.setUserObject(userObj);
}
else{
String sUserExit = (String)userObj.get("CALLED");
System.out.println("UserExit:"+sUserExit+":User:"+userObj);
if("Y".equals(sUserExit))
return ;
else
userObj.put("CALLED","Y");

}

//calling changeOrder API
YIFApi chOrdApi= YIFClientFactory.getInstance().getApi();
chOrdApi.changeOrder (env, makeXML(inXML).getDocument());

[{"Product":{"code":"SS6PEW","label":"IBM Sterling Order Management"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

PRI48886

Product Synonym

[<p><b>]Fact[</b><p>];

Document Information

Modified date:
16 June 2018

UID

swg21550870