Solved

Why are fields defaulting? 22R2

  • 17 November 2023
  • 11 replies
  • 174 views

Userlevel 5
Badge +15

Hello,

 

Currently, there is a field on the Supplier for Purchase Part page called “discount %”. It is set to mandatory from the get-go, but it also automatically defaults to zero, so the mandatory setting is a bit useless since it will never not have a value unless you delete the zero.

 

Is there any way I can remove this zero from defaulting onto the field so we can make sure users are entering the correct value? I would normally create a workflow to do this but since this is before the part is created, it doesn’t seem like it would work.

 

Thanks,
Bryan

 

 

icon

Best answer by kamnlk 22 November 2023, 04:47

View original

11 replies

Userlevel 3
Badge +5

Hi Bryan,

You should be able to do this using a workflow. In the workflow configurations, projection action you can listen to SupplierForPurchasePartHandling → PurchasePartSupplier_Default() with process enrichment type with After timing. In the workflow you can set the value for the “Discount” to null to get this behavior. 

Userlevel 6
Badge +15

@kamnlk are you allowed to update from 0 to null if the field is set as mandatory?

What about creating a User interaction WF and once the SFPP is saved, trigger the WF and ask the user for the Discount% → read user’s response and update SFPP?

Userlevel 3
Badge +5

yes in this case we are overriding the value of the default() function. we are not changing any value from database, just the client-side prefilled values.

the expected output would be like this 

 

the projection action configuration used

 

Userlevel 5
Badge +15

Hi Bryan,

You should be able to do this using a workflow. In the workflow configurations, projection action you can listen to SupplierForPurchasePartHandling → PurchasePartSupplier_Default() with process enrichment type with After timing. In the workflow you can set the value for the “Discount” to null to get this behavior. 

Hi @kamnlk if the timing is set to after, wouldnt this error out no matter what since the mandatory field would be set to null? Are you aware of any IFS functionality that allows for the modification of data on retrieval of fields? I noticed that for customer order lines, when you enter a qty the prices update automatically even though the line hasnt been saved yet.

 

Thanks,
Bryan

Userlevel 3
Badge +5

@kamnlk are you allowed to update from 0 to null if the field is set as mandatory?

What about creating a User interaction WF and once the SFPP is saved, trigger the WF and ask the user for the Discount% → read user’s response and update SFPP?

Sorry i missed to reply about the latter part; Yes, using a User interaction WF is another approach for this use case. 

Userlevel 3
Badge +5

Hi Bryan,

You should be able to do this using a workflow. In the workflow configurations, projection action you can listen to SupplierForPurchasePartHandling → PurchasePartSupplier_Default() with process enrichment type with After timing. In the workflow you can set the value for the “Discount” to null to get this behavior. 

Hi @kamnlk if the timing is set to after, wouldnt this error out no matter what since the mandatory field would be set to null? Are you aware of any IFS functionality that allows for the modification of data on retrieval of fields? I noticed that for customer order lines, when you enter a qty the prices update automatically even though the line hasnt been saved yet.

 

Thanks,
Bryan

Hi @bdoucette ,

 

Not quite, in this case we are not modifying/intercepting the api call that creates the purchase part. we are only changing the api response that populates the default values in the UI (PurchasePartSupplier_Default). Using this approach, we are preventing 0 from defaulting to discount so we can make sure users are entering the correct value in that field.

 

Are you aware of any IFS functionality that allows for the modification of data on retrieval of fields?

im not too sure about it but I think there is a functionality to apply validation rules which can be set to fields to make them automatically adjust values. 

Userlevel 5
Badge +15

Hi @kamnlk

I’ve never done that before so this is very exciting! In said workflow, how do you change the value returned to the form? If you access that projection, I’m assuming it wouldn't be an Update or Call action.. so I’m not sure how you’d achieve that other than just using a javascript script task to update that returned value then just end the workflow? Am I on the right track?

Thanks,
Bryan

Userlevel 5
Badge +15

Nevermind, I got it to work. Thanks @kamnlk !

Userlevel 3
Badge +5

Hi @kamnlk

I’ve never done that before so this is very exciting! In said workflow, how do you change the value returned to the form? If you access that projection, I’m assuming it wouldn't be an Update or Call action.. so I’m not sure how you’d achieve that other than just using a javascript script task to update that returned value then just end the workflow? Am I on the right track?

Thanks,
Bryan

Yes, you are on the right track. we can use a script task in the workflow to modify the input variable. (adding this comment for future reference)

Glad you got it sorted out

Userlevel 5
Badge +15

@kamnlk Thanks again for the suggestion, I think I’m really close to getting the correct end result.

 

Additionally, it was requested that the sourcing option parameter for the sales part page be defaulted to primary supplier transit for every sales part in that creation screen (before user selects save)

The one thing that I’m having trouble with is that the sourcing option defaults when you enter a value into the Sales Part No field, which also populates the Part No. The Sourcing Option changes to inventory order, probably because its putting the part number into the inventory part field.


The same thing happens when selecting a sales part no from the LOV.

 

I added all of the projection calls found in the debug logs to the workflow but so far, none have helped.

 

Any advise? Thanks

 

As you can see, Sourcing option defaults to inventory order after sales part no is entered

 

Projection actions on workflow:

 

Server invokes:

  • SalesPartHandling.svc/SalesPartSet/IfsApp.SalesPartHandling.SalesPart_Default()
  • SalesPartHandling.svc/GetCatalogDesc(CatalogNo='0-TK1',Contract='100')
  • SalesPartHandling.svc/ValidatePartNo(PartNo='0-TK1',Contract='100',PartDescriptionInUse='Tune%20Up%20Kit',ValidateFromCatalog=false)

 

Logs:

Application - CMD(1): > PartNo := "0-TK1"

Application - CMD(1): function({"name":"ValidatePartNo(PartNo=$[PartNo],Contract=$[Contract],PartDescriptionInUse=$[PartDescriptionInUse],ValidateFromCatalog=false)","projection":"SalesPartHandling","bound":false})

Application - CMD(1): > PartInfoVar := {"@odata.context":"https://burtprocess-cfg.ifs.cloud/main/ifsapplications/projection/v1/SalesPartHandling.svc/$metadata#IfsApp.SalesPartHandling.InventPartInfo","@odata.type":"#IfsApp.SalesPartHandling.InventPartInfo","PartDescription":"Tune Up Kit","InventoryUnitMeas":"Ea","CatchUnitMeas":null,"CatchUnitEnabled":false,"Configurable":false,"Dop":false,"SourcingOption@odata.type":"#IfsApp.SalesPartHandling.SourcingOption","SourcingOption":"InventoryOrder","ConditionCodeUsage":"NOT_ALLOW_COND_CODE","PartNotExistFlag":true,"StatisticalCode":null,"AcquisitionOrigin@odata.type":"#Decimal","AcquisitionOrigin":null,"AcquisitionReasonId":null}

Application - CMD(1): set({"name":"PartInfoVar.PartDescription"})

Application - CMD(1): > InventoryPartDesc := "Tune Up Kit"

Application - CMD(1): set({"name":"PartInfoVar.Configurable"})

Application - CMD(1): > Configurable := false

Application - CMD(1): set({"name":"PartInfoVar.Dop"})

Application - CMD(1): > Dop := false

Application - CMD(1): set({"name":"PartInfoVar.SourcingOption"})

Application - CMD(1): > SourcingOption := "InventoryOrder"

 

 

Badge +3

Currently, when a Sales Part is created, it is automatically defaulting to a Sourcing Option of Inventory Order.  We are using a the Sales Part Counter (Event Action) to generate a new Sales Part number, and even when the team sets the Sourcing Option to Shop Order, once the Part Counter gives them the new number and they place it into the Sales Part Number field, the Sourcing Option reverts back to Inventory Order, and they have to change it again to Shop Order.  Is there a way to set the default for our Sales Parts to Shop Order instead of Inventory Order?

Reply