I've created a custom field called "A Date" for the sales order line. I need to make this custom field mandatory for sales staff. So I can't use "Conditional Fields.." and "Base Profile".
When I add a custom event, I can't check for null or not. Because the field is already passing null. Do you have any solution suggestions?
Page 1 / 1
Not sure what you mean by “Because the field is already passing null.” If the value is null, can you not use Error_Sys.Record_General() to roll back the change (assuming this is a “Before” event)?
If the field is coming through as null by default that should be what you want. Stop the insert (or edit) unless the value is NOT null.
Can you post the PL/SQL block from the Event Action?
Thanks,
Joe Kaufman
Hi Mr @sutekh137,
To make it more understandable, I will explain directly through an example.
As you know, when we add a new custom field to the "customer_order_line" logical unit, it becomes "customer_order_line_cfv". Let the name of the added custom field be "test_field".
When adding a new order line, "test_field" should not be empty. I created custom event for "customer_order_line_cft" for control. And in the custom event I'm also checking for null.
When the end user creates a sales order line, the custom event is not triggered because no data is entered in the "test_field" field or any field in the "customer_order_line_cft" table. You can try it and see.
Thanks,
Barış
Barış
Have you tried simplifying the PL/SQL code to just displaying an error message (using Error_Sys.Record_General(), for example)? Can you provide screen shots of how you have the event/action configured and paste your PL/SQL code here? If the event is not triggering at all, remove rules and PL/SQL code until you do get something to trigger. I don’t know why the event just wouldn’t be triggering. Unfortunately I don’t have time at the moment to mock up a Custom field on this LU and test this out. Until you can get a simple event to trigger, it is hard to say whether this is related to the value of the custom field or not.
Thanks,
Joe Kaufman
Hi Mr @sutekh137,
To make it more understandable, I will explain directly through an example.
As you know, when we add a new custom field to the "customer_order_line" logical unit, it becomes "customer_order_line_cfv". Let the name of the added custom field be "test_field".
When adding a new order line, "test_field" should not be empty. I created custom event for "customer_order_line_cft" for control. And in the custom event I'm also checking for null.
When the end user creates a sales order line, the custom event is not triggered because no data is entered in the "test_field" field or any field in the "customer_order_line_cft" table. You can try it and see.
Thanks,
Barış
Hi @baris.halici ,
Try to change your custom event by selecting it to fire when ‘Objects are added’ and ‘Before’. Don’tadd conditions to fire. So whenever a new order line is added the event should fire.
Then you can use the event action to check test_field is not null and raise an error. If no conditions are added on the event it always fires when you choose when new objects are added.
Hello @sutekh137 and @Chamika Dilhani,
I have sent the debug console details of 2 sales order lines. In the 1st, cft is not triggered because no value is entered in the custom field. The cft is triggered because a value is entered in the 2nd line.
If cft is not triggered here, how do I check if the custom field is enforced? I wanted to say.
Mr @sutekh137, I don't know how else to explain. If it is not clear, I can share the remote link..
Regards,
Barış.
Hi @baris.halici ,
Your custom event should always fire when you add a new customer order line if you select fire when new objects are added and no conditions are added.
Then you can write your PL/SQL block inside the event to check if your custom field is NULL.
Hope this is clear.
To add a picture that may help:
Event Action Screen
This is a test Action I have configured that fires for Custom Even CUSTOMER_ADDED. Notice that “Conditions for performing this action” is an empty listing, meaning this will fire every time a CustomerInfo record is added.
Instead of controlling trigger behavior with Conditions, all business logic is performed in the PL/SQL block. The code above is very simple -- it raises an error every time, preventing a CustomerInfo record from being added (when the Action is turned on). In that code block is where you can place an IF block that checks whether or not your custom field is null and act accordingly.
Good luck,
Joe Kaufman
Hi @baris.halici ,
Kindly check if below helps you.
I have created TEST_DATE custom filed on LU ‘CustomerOrderLine’.
Then I have created a custom event like below.
Event Action.
Now I get the error when creating a CO line without adding a value to the custom filed I created. See below.
Hi @baris.halici ,
I observed the issue reported by you in our core latest APP9 UPD version and APP10 UPD 10 AS Release version.
But, the above solution I suggested works fine in APP10 latest core environment (UPD13). Thus I believe it has been resolved in a framework patch with the update.
I believe , in APP10 UPD10 and lower versions, the event does not get triggered, when the C_DATE IS NULL, because the only added CF in our CFT is C_DATE. So no records get inserted to the CFT. Thus, when we do not enter a value to the C_DATE the event doesn’t fire.
This has been resolved in our latest core, thus once your solution upgraded to UPD13.
Until you upgraded, I can suggest you a possible workaround.
Create another custom field for the same LU.
add a default value like a space.
Then try out the same custom event and action.
I tested this successfully in our core environment.
Hope this information helps you.
I guessed this was a version error. I'm glad the problem is understood and I love your solution suggestion. Thank you very much Miss Dilhani!