Hi @chrisplant,
Could you share the PL/SQL block you have written as well? According to the error message, it looks like you have not declared a variable in your PL/SQL block.
Interesting topic as we have this exact same requirement.
It’s roughly along the lines of this (still in rough format currently)
DECLARE
attr_ varchar2(1000);
info_ varchar2(1000);
objid_ varchar2(1000);
objversion_ varcahr2(1000);
BEGIN
attr_ := NULL;
&NEW:PART_NO := 'J40001'; -- Hard coded value for testing
-- Crashes on this line.
CLIENT_SYS.Clear_Attr(attr_);
CLIENT_SYS.Add_To_Attr(CONTRACT'','01 ', attr_);
CLIENT_SYS.Add_To_Attr('ACTIVEIND_DB', ' 1', attr_);
CLIENT_SYS.Add_To_Attr('PART_NO', ' &NEW:PART_NO', attr_);
-- Additional attributes still to add
sales_part_api.New__(info_, objid_, objversion_, attr_, 'DO');
end;
I was not under the impression you could change a “new” field value and have it be used throughout the event and subsequent “base” calls in IFS? I guess I should play with that…
Is it valid to place a “new” field on the left-hand side of an assignment? Does it filter through to the actual “New__” method? I am curious as to how this is accomplished.
Thanks,
Joe Kaufman
OK, I played around with this some, and I better understand what you are trying to do… I wrote a simple event on CustomerInfo that would force the Name to always be the same. It looks like this:
DECLARE
attr_ varchar2(1000);
info_ varchar2(1000);
objid_ varchar2(1000);
objversion_ varchar2(1000);
BEGIN
--&NEW:NAME := 'New Customer Will Always Have This Name!';
CLIENT_SYS.Clear_Attr(attr_);
CLIENT_SYS.Add_To_Attr('NAME', '&NEW:Name', attr_);
END;
I have the line that directly sets the “Name” field commented out because it causes an error. Specifically, the colon on the left-hand side of the assignment operator is most unappreciated by the compiler. I know it is the colon because I moved the line around and the error thrown always mentions the row and column where the colon hits. So, I am not sure how your code gets beyond that line and error.
The next problem as I see it is that the attr_ you are manipulating in this event is a local variable. It is not the same attr_ that will pass through to the New__ method once the event is completed. Calling a completely different method should work with whatever you assemble as the attr_ string, but I don’t see how you can change what gets passed to the underlying event you are sitting atop?
When I use the action above. it fires without error, but even though I am clearing attr_ out, the Customer record saves fine and the Name field is left as it was typed into the screen.
Thanks,
Joe Kaufman