Button to auto-print SSRS report via Data Directive

Hi,

I’ve created a data directive to auto-print an SSRS report. What I’d like to do is create a button on the Quote Form which triggers this directive.

image

What’s the best way to do this in App Studio? Can I invoke the Data Directive specifically?

Many thanks

A Data Directiev is triggered off a data change, so you need to change the conditional data to trigger the data trigger.

1 Like

Ah, thanks for the reply. Is there a way around this to map the button click to trigger the data directive? (i.e. using the ‘on-click’ event for the button In App Studio).

I wanted to use a data directive to generate the report as there is an ‘Auto Print’ action available in the Data Directive designer, which is not in Method Directives.

Hi @ZanebK ,

Option 1: Drop a row into a UD table using Rest-Erp - This was just a quick mock up for POC purposes.

Call rest UD02.UpdateExt svc after button click:

image

Then in the method parameters in the “ds”:

Note: You will need to ensure the combination of the Key 1 – Key 5 create a unique combination in order for a new row to be generated in the UD02 table. - There is probably a better way like calling GetaNewUD02 then passing in the dataset then calling the update.

Thereafter you should be able to use a data directive on the UD02 table.

  1. In-Trans
    Conditions where “row added” to the UD02 table then enable post directive.

  2. Standard
    Conditions where enabled from your in-trans directive then your a auto print widget.

Option 2: Calling the report svc to submit via task agent (In this example I’ve done it with the Job Traveller)

Overview of workflow.

I created a re-usable function to retrieve the client workstation (clientcomputer name + username) then pass this variable into a TransView.WorkstationID filed in the row update.

Thereafter it was just a mapping exercise to populate the dataset in method parameters (These essentially will be relatively similar to the parameters in you auto print configuration widget but for the quote report). – You will be able to test this via the Rest API Helper

Personally, I would opt for option 2, as there are back-end triggers that update certain fields, for example Rpt.JobTravSvc when executed will update the last printed field.

Anyways hope this helps.

2 Likes

Hi Alex - thanks a lot!!
Got it working using ‘SubmitToAgent’ to identify the required parameters and creating a function to call the report svc.

Will need to apply your method of setting the Workstation ID - for now, it works when I hard-code my current Workstation ID.

Thanks for your help - I can now create cool little shortcuts that will save users several clicks :blush:

2 Likes

Nicely done, great mindset to have also.

Sounds like your making some good progress and really getting to grips with the toolset Epicor has to offer.

Keep up the good work mate !

1 Like

Sorry to dig up an old thread. I am new to functions, and struggling to figure out how to grab the output of the AgentID and pass it to the row-update.

Would this need to be in the Response Parameters of the function, and use actionResult.“MyFunctionOutputName” as the pass to the row-update? If correct, the confusing part is that I have never done a response parameter with much success.

image

No worries @ehowley

For retrieving for the result from the function you shouldn’t need to parse a response, you should just be able to add the following expression “{returnObj.YourFunctonOutputField}” to the expression field in your row update editor.

Please find screenshot below as a quick visual example regarding parsing the response from a rest-erp widget using the rest helper to get an idea of mapping the returned dataset from the rest call to a data view.

I hope this helps.

Thank you for the response,

After updating the WorkstationID from the function, I try to map the JobTrav JSON. However, I still have no luck getting a preview to launch from the SubmitToAgent.

Is there an extra step to get the preview to launch? Or am I simply mapping the JSON improperly.