Add Item Attr

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

procedure <procedure_name>

(itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
result in out varchar2)
is

begin

--
-- RUN mode - normal process execution
--
if (funcmode = 'RUN') then
-- your run code goes here
null;
wf_engine.SetItemAttrText(itemtype,
itemkey,
'<existing_attribute_name>',
'<Existing attribute value>');
begin
wf_engine.SetItemAttrText(itemtype,
itemkey,
'<new_attribute_name>',
'<New attribute value>');
exception
when others then
if (wf_core.error_name = 'WFENG_ITEM_ATTR') then
wf_engine.AddItemAttr(itemtype,
itemkey,
'<new_attribute_name>');
wf_engine.setitemattrtext(itemtype,
itemkey,
'<new_attribute_name>',
'<New attribute value>');
else
raise;
end if;
end;
-- example completion
result := 'COMPLETE:';
return;
end if;

--
-- CANCEL mode - activity 'compensation'
--
-- This is in the event that the activity must be undone,
-- for example when a process is reset to an earlier point
-- due to a loop back.
--
if (funcmode = 'CANCEL') then
-- your cancel code goes here
null;
-- no result needed
result := 'COMPLETE';
return;
end if;
--
-- Other execution modes may be created in the future. Your
-- activity will indicate that it does not implement a mode
-- by returning null
--
result := '';
return;

exception
when others then
-- The line below records this function call in the error
-- system in the case of an exception.
wf_core.context('<package_name>',
'<procedure_name>',
itemtype,
itemkey,
to_char(actid),
funcmode);
raise;
end <procedure_name>;

You might also like