This worked on a standard free entry field, but does not work on a referenced field. Is there any way to do this via script, or will this require a different method to update? Any thoughts are appreciated.
Best answer by anmise
MWitczak wrote:
anmise wrote:
MWitczak wrote:
Hello,
I’ve been trying to use PL/SQL scripts to update some custom fields in IFS 10. I used the following:
This worked on a standard free entry field, but does not work on a referenced field. Is there any way to do this via script, or will this require a different method to update? Any thoughts are appreciated.
If it’s a reference field you’d have to update the source and not the custom field.
When you say update the source, I’m not quite certain what that means? Forgive me, as I am somewhat new to these custom objects.
The persistent custom reference field is attached to the inventory_part and the LU reference is CustOrdCustomer. The company wants to associate inventory parts to certain customers, so the CF_CUSTOMER field was added to the Inventory Part logical unit. I’m fetching the OBJID for that particular inventory part via cursor and then attempting to associate the particular customer to that inventory part.
Thank you for taking the time to respond.
I misunderstood, didn’t realise it was a persistent reference field.
You will need to get the objkey from the source for the reference.
In the quick example below (you’ll obviously have to get the objid for the object you want to update, p1_, but just an example) I’m getting OBJKEY from ABC_CLASS which is what my custom field is referencing.
DECLARE
-- p0 -> __lsResult
p0_ VARCHAR2(32000) := NULL;
-- p1 -> __sObjid
p1_ VARCHAR2(32000) := 'AAB2i+AAFAAAYZMAAA';
p2_ VARCHAR2(32000);
-- p3 -> __lsAttr
p3_ VARCHAR2(32000) := '';
-- p4 -> __sAction
p4_ VARCHAR2(32000) := 'DO';
cursor get is
select objkey from ABC_CLASS where abc_class='C';
BEGIN
for rec_ in get loop
CLIENT_SYS.ADD_TO_ATTR('CF$_TEST_REF', rec_.objkey, p2_);
IFSAPP.INVENTORY_PART_CFP.Cf_Modify__(p0_ , p1_ , p2_ , p3_ , p4_ );
end loop;
END;
When I run the above code it’ll update my field.
A quick tip is that you manually update your field with the debug console open (CTRL+SHIFT+D) and then copy the modify call from PL/SQL Details tab.
Let me know if you need further help or if this gives you enough to get by.
This worked on a standard free entry field, but does not work on a referenced field. Is there any way to do this via script, or will this require a different method to update? Any thoughts are appreciated.
If it’s a reference field you’d have to update the source and not the custom field.
This worked on a standard free entry field, but does not work on a referenced field. Is there any way to do this via script, or will this require a different method to update? Any thoughts are appreciated.
If it’s a reference field you’d have to update the source and not the custom field.
When you say update the source, I’m not quite certain what that means? Forgive me, as I am somewhat new to these custom objects.
The persistent custom reference field is attached to the inventory_part and the LU reference is CustOrdCustomer. The company wants to associate inventory parts to certain customers, so the CF_CUSTOMER field was added to the Inventory Part logical unit. I’m fetching the OBJID for that particular inventory part via cursor and then attempting to associate the particular customer to that inventory part.
This worked on a standard free entry field, but does not work on a referenced field. Is there any way to do this via script, or will this require a different method to update? Any thoughts are appreciated.
If it’s a reference field you’d have to update the source and not the custom field.
When you say update the source, I’m not quite certain what that means? Forgive me, as I am somewhat new to these custom objects.
The persistent custom reference field is attached to the inventory_part and the LU reference is CustOrdCustomer. The company wants to associate inventory parts to certain customers, so the CF_CUSTOMER field was added to the Inventory Part logical unit. I’m fetching the OBJID for that particular inventory part via cursor and then attempting to associate the particular customer to that inventory part.
Thank you for taking the time to respond.
I misunderstood, didn’t realise it was a persistent reference field.
You will need to get the objkey from the source for the reference.
In the quick example below (you’ll obviously have to get the objid for the object you want to update, p1_, but just an example) I’m getting OBJKEY from ABC_CLASS which is what my custom field is referencing.
DECLARE
-- p0 -> __lsResult
p0_ VARCHAR2(32000) := NULL;
-- p1 -> __sObjid
p1_ VARCHAR2(32000) := 'AAB2i+AAFAAAYZMAAA';
p2_ VARCHAR2(32000);
-- p3 -> __lsAttr
p3_ VARCHAR2(32000) := '';
-- p4 -> __sAction
p4_ VARCHAR2(32000) := 'DO';
cursor get is
select objkey from ABC_CLASS where abc_class='C';
BEGIN
for rec_ in get loop
CLIENT_SYS.ADD_TO_ATTR('CF$_TEST_REF', rec_.objkey, p2_);
IFSAPP.INVENTORY_PART_CFP.Cf_Modify__(p0_ , p1_ , p2_ , p3_ , p4_ );
end loop;
END;
When I run the above code it’ll update my field.
A quick tip is that you manually update your field with the debug console open (CTRL+SHIFT+D) and then copy the modify call from PL/SQL Details tab.
Let me know if you need further help or if this gives you enough to get by.
That worked like a charm. I am so appreciative of your help! I must have missed the objkey reference out of the debugger. Thank you again for sharing your knowledge!
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.