How to use InvokeServiceMethod in Calculated field

View previous topic View next topic Go down

How to use InvokeServiceMethod in Calculated field

Post  Admin on Thu Jan 06, 2011 8:56 pm

Usage is:
InvokeServiceMethod("Service Name","Method Name","InputProp1=val1 , InputProp2=val2", OutputProp)

Lets take an example to get more clarity on how it is used:

Create a Business Service named “MyTest” having method “Test” and 3 parameters named “prop1”, “prop2”, outP where first two are Inputs and outP is output.

Write the script below in PreInvokeMethod:

if(MethodName == "Test"){
var a = Inputs.GetProperty("prop1");
var b = Inputs.GetProperty("prop2");
TheApplication().Trace("prop1 = "+a);
TheApplication().Trace("prop2 = "+b);
Outputs.SetProperty("outP", a+b);
return (CancelOperation);

Create a calculated field named “MyCalc” in a BC. Suppose, Service Request BC.
In Calculated Value:
Note that Input and Output property name should be exactly same as it is declared in Business Service under Method.

Write a script in ChangeRecord event of Service Request BC.

var t = this.GetFieldValue("MyCalc");
TheApplication().Trace("Output = "+t);

The output value returned by the business service gets stored in the MyCalc field.


Posts : 21
Join date : 2010-02-25

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum