Monday, September 15, 2008

DFF Segment Disabling

Used in situations where you enable a DFF segment and can update the value in only one responsibility and not allow other responsibilities to update the value.


In custom.pll write code for When-Validate-Record.

Here check if resp<> 'X'


Now if its a new record then the user should not assign any value to this DFF segment from this reponsibility. user can assign only from Resp X.


So if record status=new and block.attribute1 is not null means he assigned a value. So raise error.

If its an old record and user is trying to update the value then check the old value from the database. compare this value with the new value which has been entered in the form.


If both are same then he didnt update so no need to throw an error. If both values are different he has updated so need to throw error.


To get the old value from database u will need to query the table with the current record primary key.New value is assigned to the form item.


Below is the pseudo code

If event='When-Validate-Record' then

if current_responsibility<>'X' and record_status='INSERT' and block.attribute1 is not null then

fnd_message.set_string('Cant assign value');

fnd_message.error;

raise form_trigger_failure;

elsif current_responsibility<>'X' and record_status='CHANGED' and block.attribute1!=old value of attribute1(queried from database) then

fnd_message.set_string('Cant assign value');

fnd_message.error;

raise form_trigger_failure;

end if;

end if;

No comments: