Mandatory Field
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
app_item_property2.set_property('ORDER.CUST_PO_NUMBER',REQUIRED, PROPERTY_ON);
end if;
end if;
Restricting Field Case
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
app_item_property2.set_property('ORDER.CUST_PO_NUMBER',CASE_RESTRICTION, UPPERCASE);
end if;
end if;
Changing Field Background Color
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
app_item_property2.set_property('ORDER.TERMS',BACKGROUND_COLOR,'r255g0b255');
end if;
end if;
Note- Colors can be derived from http://www.geodyssey.com/galileo/namedcolors.html
Changing Field Prompt
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'WSHFRREL' AND block_name = 'RELEASE') then
app_item_property2.set_property ('RELEASE.ORDER_NUMBER', prompt_text, 'Sales Order Number');
end if;
end if;
Disabling Field
if (event_name = 'WHEN-NEW-ITEM-INSTANCE') then
if (form_name = 'OEXOEORD' AND block_name = 'ORDER') then
COPY ('Business World', 'ORDER.SOLD_TO');
VALIDATE (item_scope);
app_item_property2.set_property ('ORDER.SOLD_TO', enabled, property_false);
end if;
end if;
Thank you very much. But how about descriptive flexfields ? I have a dff with several items, some are required and some are not. I try to make all not required with the following code.
ReplyDeleteIF (event_name = 'WHEN-NEW-RECORD-INSTANCE' AND form_name = 'ARXTWMAI') THEN
app_item_property2.set_property(
'TGW_HEADER.DESC_FLEX'
, REQUIRED
, PROPERTY_OFF);
END IF;
Although I compile and log in again, it has no effect. If I cange the item to something not existing, I get an error when I open the AR transaction window, so I know I'm on a right track. The name off the dff in forms Builder is DESC_FLEX_MIR, I've tried also with this name.
Best regards
Christian