Home » Developer & Programmer » Forms » Issue in firing of when-create-record trigger
Issue in firing of when-create-record trigger [message #570117] Mon, 05 November 2012 14:33 Go to next message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
Hi,
I am navigating from a Master form to a child form. The when-create-trigger in the child form is sometimes executing and sometimes not. Not firing of this trigger is causing the child form to open without any initially assigned values. Please let me know the root cause and also the scenarios where the when-create-trigger fires.


Regards,
Deeps
Re: Issue in firing of when-create-record trigger [message #570125 is a reply to message #570117] Mon, 05 November 2012 15:11 Go to previous messageGo to next message
joy_division
Messages: 4514
Registered: February 2005
Location: East Coast USA
Senior Member
What do you mean by "when-create-trigger?" I am unfamiliar with a trigger by that name, but it could just be that I never used one.
Re: Issue in firing of when-create-record trigger [message #570126 is a reply to message #570125] Mon, 05 November 2012 15:14 Go to previous messageGo to next message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
when-create-record trigger fires when the navigation to the child form is done for the second time.
Re: Issue in firing of when-create-record trigger [message #570127 is a reply to message #570126] Mon, 05 November 2012 15:14 Go to previous messageGo to next message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
Joy - sorry, it is when-create-record trigger.
Re: Issue in firing of when-create-record trigger [message #570159 is a reply to message #570127] Tue, 06 November 2012 02:00 Go to previous messageGo to next message
Littlefoot
Messages: 19615
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Run the form in debug mode in order to find why it fires (or not).
Re: Issue in firing of when-create-record trigger [message #570198 is a reply to message #570159] Tue, 06 November 2012 12:52 Go to previous messageGo to next message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
Hi Littlefoot,
I had put the debug statement and when observed, ideally in the first time, in the goto_block (child form) call, 'when-create-record' trigger of the child_form fires and i see the values assigned. But if it does not fire, then the values are not assigned. In such scenario, for the second time when i try to access the child screen, the trigger fires. So it is not that the issue is observed always. If it does not work first time, it works surely for the second time.


Regards,
Pradeep
Re: Issue in firing of when-create-record trigger [message #570202 is a reply to message #570198] Tue, 06 November 2012 14:19 Go to previous messageGo to next message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
Can anybody tell me what is the scenario which triggers the execution of 'when-create-record' trigger?
Re: Issue in firing of when-create-record trigger [message #570206 is a reply to message #570202] Tue, 06 November 2012 14:40 Go to previous messageGo to next message
Littlefoot
Messages: 19615
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Which Forms version do you use?

Scenario? WHEN-CREATE-RECORD trigger fires when someone creates a record (either by pressing the <Insert> or scrolling down to the last + 1 record (i.e. a new, empty one) in a block).
Re: Issue in firing of when-create-record trigger [message #570212 is a reply to message #570206] Tue, 06 November 2012 14:54 Go to previous messageGo to next message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
It is version 6.0.
Since i am navigating from Parent to Child form, an empty record is getting created but the W-C-R trigger is not firing consistently.
Re: Issue in firing of when-create-record trigger [message #570214 is a reply to message #570212] Tue, 06 November 2012 15:30 Go to previous messageGo to next message
Littlefoot
Messages: 19615
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How exactly do you navigate to a child ... hm, form? (Is it really a FORM or did you mean a BLOCK?) Where do you end up? In an existing record (by default, that would be the first record in a child block) or somewhere else?

Could you post trigger code? Please, see how to format it and how to use [code] tags which will preserve formatting and make it easier to read.
Re: Issue in firing of when-create-record trigger [message #570217 is a reply to message #570117] Tue, 06 November 2012 16:39 Go to previous messageGo to next message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
Hi Littlefoot, Thanks for your replies.
In EBS, under the Order Acceptance screen, in the Lines tab, when i click onto the 'H' column, it takes to 'Release Holds' screen. Here, sometimes, the header Id & Line Number is not updated onto the 'Release Holds' screen and the reason i observed is that during such instances, the -W-C-R' trigger is not getting fired.
Code gives call to procedure - order_holds_pkg.event ('WHEN-CREATE-RECORD');
Below is the details of the Program Unit associated.

			
	ELSIF p_event = 'WHEN-CREATE-RECORD' THEN
                        IF :parameter.hold_caller = 'H' THEN				
				:order_holds.order_number := :order.order_number;
				:order_holds.header_id := :order.header_id;
				:order_holds.held_by := oe_holds_pvt.user_name(v_user_id);
				:order_holds.creation_date := trunc(sysdate);
			ELSIF :parameter.hold_caller = 'D' THEN
                                :order_holds.order_number := :order.order_number;
				:order_holds.header_id := :order.header_id;
				fnd_message.debug(:order_holds.header_id||'F'); --sr#5292_test																
				:order_holds.line_number_dis := :oe_lines.line_number;
				:order_holds.line_id := :oe_lines.line_id;
				:order_holds.held_by := oe_holds_pvt.user_name(v_user_id);
				:order_holds.creation_date := trunc(sysdate);
			ELSIF :parameter.hold_caller = 'QH' THEN				
				:order_holds.order_number := :order_query.order_number;
				:order_holds.header_id := :order_query.oe_header_id;
				:order_holds.held_by := oe_holds_pvt.user_name(v_user_id);
				:order_holds.creation_date := trunc(sysdate);
			ELSIF :parameter.hold_caller = 'QD' THEN				
				if :order_query.record_level = 1 then					
					:order_holds.style := :order_query.style;
					:order_holds.color := :order_query.color;
					fnd_message.debug(:order_holds.line_number || 'C'||:order_holds.line_id); --sr#5292_test
					:order_holds.line_number := :order_query.query_line_id;
				elsif :order_query.record_level = 2 then					
					:order_holds.order_number := :order_query.order_number;
					:order_holds.header_id := :order_query.oe_header_id;					
					:order_holds.line_number_dis := :order_query.line_number || :order_query.shipment_number;
					:order_holds.line_id := :order_query.oe_line_id;
				end if;
				:order_holds.held_by := oe_holds_pvt.user_name(v_user_id);
				:order_holds.creation_date := trunc(sysdate);
		  ELSIF :parameter.hold_caller = 'MH' THEN				
				:order_holds.order_number := :order_maint.order_number;
				:order_holds.header_id := :order_maint.oe_header_id;
				:order_holds.held_by := oe_holds_pvt.user_name(v_user_id);
				:order_holds.creation_date := trunc(sysdate);
		  ELSIF :parameter.hold_caller = 'MD' THEN		  	
				if :order_maint.record_level = 1 then
					:order_holds.style := :order_maint.style;
					:order_holds.color := :order_maint.color;					
					:order_holds.line_number := :order_maint.query_line_id;
				elsif :order_maint.record_level = 2 then					
					:order_holds.order_number := :order_maint.order_number;
					:order_holds.header_id := :order_maint.oe_header_id;					
					:order_holds.line_number_dis := :order_maint.line_number || :order_maint.shipment_number;
					:order_holds.line_id := :order_maint.oe_line_id;					
				end if;
				:order_holds.held_by := oe_holds_pvt.user_name(v_user_id);
				:order_holds.creation_date := trunc(sysdate);
			END IF;
Re: Issue in firing of when-create-record trigger [message #570220 is a reply to message #570117] Tue, 06 November 2012 19:10 Go to previous messageGo to next message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
Hi Littlefoot,
In the master screen, inline with the below code, when debug statements are placed in the 'when-create-record' trigger, after the go_block('order_holds') for the ideal scenario, i see the focus getting on the 'when-create-record' trigger and see a debug message placed there. But for the other scenario where the Ids are not getting assigned, i donot see the 'when-create-record' trigger being fired and hence the Id values are not assigned.
Hope this helps.


        go_block ('order_holds');
			
	app_window.set_window_position ('ORDER_HOLDS','CENTER','MAINWINDOW');				
			
	set_block_property ('ORDER_HOLDS', DEFAULT_WHERE, ' HEADER_ID = :order.header_id AND ((LINE_ID IS NULL AND RELEASED_FLAG = ''Y'') OR LINE_ID = :oe_lines.line_id)');		
Re: Issue in firing of when-create-record trigger [message #570225 is a reply to message #570220] Wed, 07 November 2012 00:23 Go to previous messageGo to next message
Littlefoot
Messages: 19615
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Uh, oh ... EBS is Terra Incognita for me. Being here for quite a while now, I learnt that not everything I'm used to see in "pure" Forms works the same way when EBS is discussed.

It would be great if you were on 10g which contains a debugger, walking through all code lines executed, displays various information (block, item, system variables values and such) and it makes your life easier.

Anyway: this sentence:Quote:
sometimes, the header Id & Line Number is not updated onto the 'Release Holds' screen and the reason i observed is that during such instances, the -W-C-R' trigger is not getting fired.

Can you isolate "such instances"? I don't really know how - maybe these instances have "A" in item NAME and "-5" in some other item, which causes code to fail. I noticed that "ELSIF p_event = 'WHEN-CREATE-RECORD' THEN" block you posted doesn't have an ELSE. So, maybe HOLD_CALLER parameter (in ":parameter.hold_caller = '<some_value>'") doesn't contain any value listed in IF-ELSIF so nothing happens?
Re: Issue in firing of when-create-record trigger [message #570295 is a reply to message #570117] Wed, 07 November 2012 12:36 Go to previous messageGo to next message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
Hi LittleFoot,
I really appreciate your suggestions.
Inside the When-Create-Record trigger is the call to function order_holds_pkg.event ('WHEN-CREATE-RECORD'); This Program Unit in turn evaluates :parameter.hold_caller and processes accordingly. Here since the call to When-Create-Record trigger is not happening, the code you are referring is not getting executed.
My main query is that when the go_block('order_holds'), the When-Create-Record trigger is not fired sometimes.

As FYI,
'When-Create-Record' trigger Perform an action whenever Form Builder attempts to create a new record in a block. So i see here that the new record creation is not happening sometimes.

Also could you suggest any other Trigger where i can duplicate the When-Create-Record trigger functionality so that Trigger executes atleast once.


Regards,
Pradeep
Re: Issue in firing of when-create-record trigger [message #570298 is a reply to message #570295] Wed, 07 November 2012 12:49 Go to previous messageGo to next message
Littlefoot
Messages: 19615
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How about
go_block('order_holds');
last_record;
create_record;

The above code *should* force record creation, and the WHEN-CREATE-RECORD would, actually, fire.

However, I'm not sure that this is the right way. What does that trigger do, again? You said that you move from master to child records and that trigger "assigns" some values. If the starting point is a query you execute, which causes master AND child records to appear, maybe you should try with the POST-QUERY trigger (I mean, put your WHEN-CREATE-RECORD code into the POST-QUERY).

[Updated on: Wed, 07 November 2012 12:49]

Report message to a moderator

Re: Issue in firing of when-create-record trigger [message #570300 is a reply to message #570298] Wed, 07 November 2012 14:45 Go to previous message
Ora_Deeps
Messages: 17
Registered: June 2012
Location: San Francisco
Junior Member
Hi Littlefoot,
I added the WHEN-CREATE-RECORD code into WHEN-NEW-BLOCK-INSTANCE trigger since i wanted the data to be assigned as soon the focus enters the New Block. Functionality looks to be working!!! I need to do an exhaustive testing to ensure that no other function breaks.
Let me know if you have any suggestions.

Thanks a Ton!!!

Regards,
Pradeep
Previous Topic: show manager with employee
Next Topic: Form 6i Last Value
Goto Forum:
  


Current Time: Fri Sep 19 04:54:33 CDT 2014

Total time taken to generate the page: 0.08142 seconds