Parameter order for webSdk procedures

158 Views Asked by At

I need to create some reports using the websdk pertaining to orders and price quotes. I tried following the documentation but even the example given in the developer portal is lacking a lot of crucial information.

Specifically, I need to work with these two procedures:

  • ESH_WWWSHOWORDER3
  • ESH_WWWSHOWCPROF2

I tried writing some logic arround the sample found on https://prioritysoftware.github.io/api/procedure/#Introduction

const procedure = priority.procStart(PROC_NAME,"R", () => {},customerName, function(procSuccess){
                        logger.info('Proc start OK, received documentOptions');
                        logger.info(JSON.stringify(procSuccess));
                        logger.info('Specifying format...');
                        resolve(new Promise((resolve, reject) => {
                            procSuccess.proc.documentOptions(1,1,2,procSuccess => {
                                logger.info('Received inputFields');
                                logger.info(JSON.stringify(procSuccess));
                                procSuccess.proc.inputFields(1,{ORDNUM: ordernum}, procSuccess => {
                                    logger.info('Received url');
                                    logger.info(JSON.stringify(procSuccess));
                                });
                            }, procError => {
                                reject(procError)
                            })
                        }));
                    }, function(procError){
                        logger.error('Proc start error');
                        logger.error(procError);
                        reject(procError);
                    });
                }).catch(err => {
                    logger.error(err);
                })

Where PROC_NAME is WWWSHOWORDER

I am trying to understand what the process is asking of me, but it's not really clear. I tried supplying some values in the order specified by the documentation but I get errors that are not very descriptive to someone who doesn't know the ins and outs of Priority.

The logs look somehting like this

 Starting Procedure WWWSHOWORDER
2019-11-26T11:55:31.718Z info: Proc start OK, received documentOptions
2019-11-26T11:55:31.719Z info: {"proc":{"name":"WWWSHOWORDER"},"type":"message","message":"No such Tabula entity"}
2019-11-26T11:55:31.721Z info: Specifying format...
2019-11-26T11:55:32.124Z info: Received inputFields
2019-11-26T11:55:32.125Z info: {"proc":{"name":"WWWSHOWORDER"},"type":"message","message":"Failure to p...

Unfortunately my logs are truncated for some strange reason...

EDIT:

I switched trying to work with ESH_WWWSHOWORDER3, I am getting an inputFields parameter, and I hope what I need to do, is take the iinputFields.input.EditFields object, and populate the value field with the name of the order, I think, unfortunately this results in a 500 error from the server...

 {"proc":{"title":"(אישור הזמנה עם מפרט ללקוח (פריו","name":"ESH_WWWSHOWORDER3"},"type":"inputFields","input":{"EditFields":[{"field":1,"helpstring":"","ispassword":0,"mandatory":0,"operator":0,"readonly":0,"title":"Order","type":"text","code":"Str","value":"*","value1":"","maxlength":56,"zoom":"Zoom","format":""}],"Operators":[{"name":"= ","op":0,"title":"equals"},{"name":"< ","op":1,"title":"less than"},{"name":"<=","op":2,"title":"less than or equal to"},{"name":"> ","op":3,"title":"greater than"},{"name":">=","op":4,"title":"greater than or equal to"},{"name":"<>","op":5,"title":"not equal to"},{"name":"- ","op":6,"title":"between"},{"name":"! ","op":7,"title":"ולא"},{"name":"| ","op":8,"title":"או"}],"text":"","title":"Parameter Input"}}
2019-12-02T09:07:10.129Z info: Specifying input...
2019-12-02T09:07:10.550Z error: @@@Can't connect to server. HTTP Response: 500, Internal Server Error
details: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><s:Header><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><u:Timestamp u:Id="_0"><u:Created>2019-12-02T09:07:07.700Z</u:Created><u:Expires>2019-12-02T09:12:07.700Z</u:Expires></u:Timestamp></o:Security></s:Header><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode><faultstring xml:lang="he-IL">Object reference not set to an instance
of an object.</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>Object reference not set to an instance of an object.</Message><StackTrace>   at WCFService.ProcEditFieldsOKMob(String session, Boolean save, Byte[] xml)&#xD;
   at SyncInvokeProcEditFieldsOKMob(Object , Object[] , Object[] )&#xD;
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.NullReferenceException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>

Again, documentation does not seem to be very detailed on this topic, the EditFields object itself is not very well described...

I am also not an experienced priority user, so I am not sure where I need to navigate to check out these procedures and what else.

1

There are 1 best solutions below

0
rozalex On

It seems that you are passing "R" as the second parameter, which means that you are calling for a report. Try passing "P" instead.

Also, what is customerName? according to the Web SDK I believe this should be dname: "Internal name of the company in which the procedure is run."

You can tell that WWWSHOWORDER is a Procedure and not a Report by going to System Management -> Generators -> Procedures -> Procedure Generator and querying for it. If you find it in the procedure generator - its a procedure (in this case it is a procedure which generates a report), and you should call it with a "P" parameter.

If you find the entity in Management -> Generators -> Reports-> ReportGenerator than its a plain Report and you should call it with the "R" Parameter.