Register new POST

 

Beas script can be defined to be executed for post command.

Call this with:

post [entityname]

 

The JSON object, which you define in the body is available for Beas script with JSON object.

For example: <j.jsonproperty>

Note:

In BeasScript  this present a ue_json-object

if Script start with #jbs the sytem deliver a jbs-object (beas 2021.05 and later)

 

Additional variables that are available:

Variable

Description

result

Write the text, which you want send to the client.

JBScript: You can return every variable / object type

code

Return the code (the default is 200 = ok.

If not 200 or return with -1, then the system return error with messagetext as error text

messagetext

Define the error code and error message, if the code is not 200
Note: in BeasScript the property is "message"

j

The Body as Json.

Note: in BeasScript property name is: b

 

 

[CompanyWorkOrderActivity/post]

// Add script to AddActivity

[/CompanyWorkOrderActivity/post]

 

 

Example: Create Activity

Body of the post command:

{

"DocEntry":[workorder docentry],

"ActivityInfo":[infoString]

}

 

 

 

 

beasscript-logo-small

[CompanyWorkOrderActivity/post]
instance bsl b
b.Workorder(<DocEntry>)?$select=DocNum,CardCode
if <b.Cardcode> = "" then

  setvar=result={"error":200,"errormessage":"Work order <j.DocEntry> not found or without cardcode"}
  return success
end if
 
declare=di=ue_api_sbo
di=getbusinessobject=ocontacts
di=CardCode=<b.CardCode>
di=DocType=59
di=details=Receipt item for <b.DocNum>
di=add
destroy=di
[/CompanyWorkOrderActivity/post]