Skip to main content

I am trying to use a workflow to call the cancel quotation line call to cancel the copied lines on the newly copied quotation to match the source quotation.  We are currently in 23r1.  On the Sales > Quotation > Sales Quotation screen we use the Copy Quotation button to create a new quotation.  For example, the source quotation has 3 quotation lines with the second line in the Cancelled status.  I am able to get the specific line to cancel but I am stuck on the call to actually cancel the line.  I am sure I am missing something simple.

 

The projection call looks like:
 

I build the variables as:
aCancelReason : "NO STOCK"

"QUOTATION_NO=C9030200B;LINE_NO=2;REL_NO=1;LINE_ITEM_NO=-1"

 

Any help is appreciated.

Can you elaborate on your workflow and the use case?

 

If I understand you right, you have quotation, you copy this quotation to some other quotation, and you want that if you cancel a line on the “original” quotation, it also cancels the line on the copy? Do I have that right ?

 

Can you please show the full the workflow as you currently have it ?

 

Out of the top of my head, but I can’t be sure that’s the problem without looking at the workflow in more depth, there might be an issue with how you call it or define the actual selection or something.

Do you get a specific error message or does it just not do anything ?


The API you’re calling requests these by the way:

 

 

So Im not sure if you can just call that projection using a selection the way you did it ? These might need to be distinct parameters

 


@SimonTestard 

Sorry for the confusion.  I am only concerned when doing the copy.  At the time of the copy, we may have 1 or more cancelled lines on the original that are coming over as planned in the copy.  I am trying to get the BPA to update these lines on the copy to Cancelled with the same cancel reason as the original.  Any changes to the original after this have no bearing on the new copy.


Ok, what is your workflow triggering on? Are you triggering it on Projection Action Copy, through an event, or through a custom command?


Projection Action Copy.

 

 


@SimonTestard 

I now get an error:
Projection call with name OrderQuotationLine_Cancel does not have the expected parameters.

 

I appreciate the help.


Ok that might be tough, in Copy Quotation, does the user leave the New Quotation No to be generated by the system, or do they fill in number?

 

If they leave the system to generate the new number, the new quotation number will not be available to you in the workflow, your parameters will look like this:

 

{"QuotationNo":"*1002","CopyDeliveryInformation":"TRUE","CopyContacts":"TRUE","ToQuotationNo":null,"CopyQuotationLines":"TRUE","CopyCustomerAddress":"TRUE","RequestReceiptDate":null,"CopyGeneral":"TRUE","ifsBpaExecutionUserId":"ifsadmin","CopyPricesandDiscounts":"FALSE","ifsBpaCurrentProjectionName":"CopySalesQuotation","WantedDeliveryDate":null,"CopyCompetitors":"TRUE","CopyNotes":"FALSE","CopyMiscQuotationInfo":"TRUE","ExpirationDate":null,"ifsBpaCurrentInputEntityTypeName":null,"CopyRentalQuoteLines":"TRUE","PriceEffectiveDate":null,"CopyRepresentatives":"TRUE","ifsBpaProjectionOperation":null,"AnsweringDate":null,"CopyCharges":"TRUE","CopyDocumentText":"FALSE"}

 

You’d need your workflow to first read and find the new Quotation Number, which I don’t think is saved anywhere on the new Quotation except for the Order Quotation History where it’s included as part of a  string:

 

 

 

You’d probably need get your workflow to read from the Histories with that text, finding the “source” quotation.

 

You’d need to read those new quotations set ((set because one quotation can be copied multiple times to multiple new quotations, although you can limit the set by only looking at new quotations created recently))

 

Then you can check on the source quotation what lines are cancelled, and on the set of new quotations, if the same line is not cancelled, through a loop, cancel them.

 

You can see how to do loops as an example here:

 

https://docs.ifs.com/techdocs/22r1/040_tailoring/500_business_process_automation/030_getting_started_with_workflows/resources/loopingDemo.bpmn

 

This would probably be quite involved to do as a workflow, if you have access to Studio Developer it’d likely be much easier to do that as an override to the projection action directly


@SimonTestard

I now get an error:
Projection call with name OrderQuotationLine_Cancel does not have the expected parameters.

 

I appreciate the help.

 

To follow up from my previous answer, how are you populating/retrieving your LineNo, RelNo and LineItemNo that you want to cancel ?

You’d also possibly need the read the etag first from the lines as this seems to be a bound action and the api doc says the etag is required in the request header (think of etag as equivalent to objversions, they ensure that by the time you call your api no one else has modified the object in the meantime)


@SimonTestard 

I was trying to get an event running off the History table also but I was having the same issue getting the quotation lines to be cancelled.  I tried the call a few replies early and received the error:
Projection call with name OrderQuotationLine_Cancel does not have the expected parameters.


@SimonTestard

I was trying to get an event running off the History table also but I was having the same issue getting the quotation lines to be cancelled.  I tried the call a few replies early and received the error:
Projection call with name OrderQuotationLine_Cancel does not have the expected parameters.

 

The workflow you attached in the thread is helpful, thanks. It doesn’t trigger off the projection action though, so do you have it triggered as part of an event at this point in time ?

 

 

One issue with doing it from the event is that you’re not entirely sure that by the time it triggers and the order history is created, the lines actually already exist and can be read from. The event trigger is during the PENDING insert transaction, and the transaction block probably includes the creation of the lines, but BEFORE the commit.

Are you sure the workflow is able to actually read the new lines when triggered from an event ? It’s POSSIBLE if the copy method actually includes implicit commits and if the insert on the history happens BEFORE the insert of the lines, but that’s a bit unclear

 


@SimonTestard 

Here is the event I am trying with that:
 

 


I’ll have a look if I get a chance tomorrow.

 

Also like I said, do you have access to Studio Developer and the ability to create customizations for your company ? Doing an override on the projection action (technically, on the underlying call within the projection action, so like probably order_quotation_api.copy_quotation__ or order_quotation_line_api.copy_quotation_line) would be much, much faster

 

 

This could easily be overriden so that after Core() you select the new lines just created and if the source ones are cancelled, you cancel those as well.


Also, looking at the main code for copy order quotation:

 

 

 

You can see that the history from Copy from quotation is created BEFORE the lines are copied over, so in my opinion it’s extremely likely that triggering the workflow on insert in quotation history won’t be able to find the new lines as they simply don’t exist yet at the moment the oracle trigger (custom event) is executed


@Frank H

 

Alright good news, I got it to work with a simple workflow. A couple points and tips for you to understand what I did:

 

  1. The workflow I made triggers from an event on OrderQuoteLineHist.

    This is done in order to avoid having to do any sort of loop in the workflow, so basically the workflow triggers “per line copied” rather than per quotation.

    This is doable because the history “copied from quotation xxx” also appears in the Quotation Line History, not just the Header history.

 

Event
Event Action

 

 

  1. The reason you were getting incorrect parameters is because the Projection Call to Cancel a Line is a Bound Action. Bound actions do not require any parameters being set manually, instead, they automatically get their parameters (including the If-Match Etag Check) from the very last entity being READ.

    I’ve set up the workflow like this:

 

Workfow

 

 

This works and ends up doing what you want.

 

 

You can see it gets immediatelly cancelled after creation when being copied and if the source quotation line is cancelled.

 

One thing I haven’t done though is set the Cancellation Reason ID, you can possibly do that by invoking another action if it’s super important, but Cancellation Reasons aren’t mandatory

 

If it’s super important to you, you can end up calling the Projection Action “CancelQuotationLines” with the “SelectionID” and “ReasonID” instead, but know that the selection needs to be written in this format, based on client_sys.text_separator:

 

“QUOTATION_NO=xxx^LINE_NO=yyy^REL_NO=zzz^LINE_ITEM_NO=nnn;”

 

Basically, the separator for the Key references is “^”. The separator for Set of Records (if you want to cancel multiple lines at once) is “;”, so NOT like you first set it in your original post:

 

Not the correct way to set a selection id

 

Note that SalesQuotationLinesHandling.svc/CancelQuotationLines is NOT a bound action and therefore it is probably not necessary to Read the Lines you’re going to cancel before calling the action.

 

I’m attaching the Application Configuration Package that includes the event, event action, and workflow being used

 

One note I’ll leave you with, be careful if you use different client languages. The event currently triggers based on the MessageText, but the message text is a translatable variable that depends on the language code being used by the user. If your users use the client in any other language than english, you’d need to amend the event trigger conditions to catch the translations there and ensure it triggers fine.

 

 


@SimonTestard

Thank you for the help.  It works as needed.


Reply