Attached to a WorkItem BO I have a dropdown linked to Teams BO. The presentation is the description attribute of the Teams BO.
I have a process that creates a WorkItem:
CREATE WorkItem WITH WorkItem.Customer=Customer, WorkItem.Teams='Team 1',WorkItem.Description='Test WorkFlow'
Team 1 exists within the linked BO Teams but this doesn't create the relationship when I run the process ???
Updating linked BO through process.
-
- Posts: 595
- Joined: Sun Apr 24, 2005 2:22 am
- Contact:
A relationship cannot be created by assigning a text value to a reference attribute. You need to get the object into the context first and then assign it to the reference attribute. This can be done with a two-rule process, for example:
FIND Team WHERE Team.Description = 'Team 1'
CREATE WorkItem WITH WorkItem.Customer=Customer, WorkItem.Team=Team,WorkItem.Description='Test WorkFlow'
FIND Team WHERE Team.Description = 'Team 1'
CREATE WorkItem WITH WorkItem.Customer=Customer, WorkItem.Team=Team,WorkItem.Description='Test WorkFlow'
Aware IM Support Team
Re: Updating linked BO through process.
Hi,
I am trying to create aprocess with the same approach but it does not work. It seems context does not work. At least the function FIND does not put in the context the result. Any reccomandation?
FIND EEE_Families WHERE EEE_Families.FamilyCode=1
CREATE EEE_Groups WITH EEE_Groups.Family=EEE_Families, EEE_Groups.GroupCode=1, EEE_Groups.GroupName='Ceramic'
I am trying to create aprocess with the same approach but it does not work. It seems context does not work. At least the function FIND does not put in the context the result. Any reccomandation?
FIND EEE_Families WHERE EEE_Families.FamilyCode=1
CREATE EEE_Groups WITH EEE_Groups.Family=EEE_Families, EEE_Groups.GroupCode=1, EEE_Groups.GroupName='Ceramic'
Re: Updating linked BO through process.
I can assure you this works in the current (and prev.) release(s).
For your benefit, you could do several things to see if your FIND even works.
1) display the value of SEARCH_COUNT to see how many recs (if any) were found, or
2) Observe the Testing Logger and you'll see your FIND statements and immediately under that you'll see how many objects were found, or
3) Use one of the LOG2 / LOG2 CONTEXT commands to insert info into the Logger output.
Due to the way you've named EEE_Groups.Family, its impossible for anyone to know what kind of relationship it is without more info from you. (This is one of my arguments FOR naming "the Bailey way", but thats another story.).
Options would be:
EEE_Groups.ps_Family // Peer relationship. This Group points "up" to 1 Family record
EEE_Groups.ob_Family // same as above. Group is owned by the Family, which only has bearing if the Family is Deleted
EEE_Groups.pm_Family // Peer Multiple. This Group record has a Family List of child references. You'd INSERT the Family record into the Family List
But chances are you're not FINDing the record you think you are. Steps 1/2/3 will clarify that.
For your benefit, you could do several things to see if your FIND even works.
1) display the value of SEARCH_COUNT to see how many recs (if any) were found, or
2) Observe the Testing Logger and you'll see your FIND statements and immediately under that you'll see how many objects were found, or
3) Use one of the LOG2 / LOG2 CONTEXT commands to insert info into the Logger output.
Due to the way you've named EEE_Groups.Family, its impossible for anyone to know what kind of relationship it is without more info from you. (This is one of my arguments FOR naming "the Bailey way", but thats another story.).
Options would be:
EEE_Groups.ps_Family // Peer relationship. This Group points "up" to 1 Family record
EEE_Groups.ob_Family // same as above. Group is owned by the Family, which only has bearing if the Family is Deleted
EEE_Groups.pm_Family // Peer Multiple. This Group record has a Family List of child references. You'd INSERT the Family record into the Family List
But chances are you're not FINDing the record you think you are. Steps 1/2/3 will clarify that.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Updating linked BO through process.
What this code will do is return ALL the EEE_Families records where FamilyCode=1. Presumably there is more than one.srufini wrote:Hi,
I am trying to create aprocess with the same approach but it does not work. It seems context does not work. At least the function FIND does not put in the context the result. Any reccomandation?
FIND EEE_Families WHERE EEE_Families.FamilyCode=1
CREATE EEE_Groups WITH EEE_Groups.Family=EEE_Families, EEE_Groups.GroupCode=1, EEE_Groups.GroupName='Ceramic'
If you then try to CREATE EEE_Groups with EEE_Groups.Family=EEE_Families then this will fail.
If you have returned more than one Families record and want to insert these into Groups.Families then you can do this a number of ways.
Call a second process which receives as inputs Families and Group. In this second process INSERT Families IN Group.Families
Or if you have created matching relationships between Family and Group.Family then CREATE the Group record and set Family.Group=Group
If you run the process and look at the test log it will tell you how many records have been returned with a FIND.
Re: Updating linked BO through process.
Probably this is the wrong way to do it. I am trying to create two list BO. One of families and one og groups. Each group is related to a family only. Many group can belong to a family.
This list is fixed and I want to be created by a process when I populate my database at the beginning.
There must be a better way to do it (reccomandation well accepted!) but I want to get to the bottom of this approach as lesson.
I am working in a process.
My first rule creates all the families, each line a family.
My second rule would like to create the groups.
What I found is, no matter what I use, IF, FIND,, the context within this process will always be locked on the first family that is created in the first rule. If I use "That" will be recalled the second one.
Accoridn got the manual, the function IF should do the trick, but not the function FIND, but neither seems to work...
This list is fixed and I want to be created by a process when I populate my database at the beginning.
There must be a better way to do it (reccomandation well accepted!) but I want to get to the bottom of this approach as lesson.
I am working in a process.
My first rule creates all the families, each line a family.
My second rule would like to create the groups.
What I found is, no matter what I use, IF, FIND,, the context within this process will always be locked on the first family that is created in the first rule. If I use "That" will be recalled the second one.
Accoridn got the manual, the function IF should do the trick, but not the function FIND, but neither seems to work...
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Updating linked BO through process.
If you do a search which returns multiple Families then any action that works on individual Business Objects (BO) will only work on the first BO that is in context.srufini wrote:Probably this is the wrong way to do it. I am trying to create two list BO. One of families and one og groups. Each group is related to a family only. Many group can belong to a family.
This list is fixed and I want to be created by a process when I populate my database at the beginning.
There must be a better way to do it (reccomandation well accepted!) but I want to get to the bottom of this approach as lesson.
I am working in a process.
My first rule creates all the families, each line a family.
My second rule would like to create the groups.
What I found is, no matter what I use, IF, FIND,, the context within this process will always be locked on the first family that is created in the first rule. If I use "That" will be recalled the second one.
Accoridn got the manual, the function IF should do the trick, but not the function FIND, but neither seems to work...
If you return 10 families from your FIND then execute a CREATE the CREATE will work only with Family1
To deal with each Family to CREATE their Group you will need to create two processes FindFamilies and GroupCreation
FindFamilies
Code: Select all
FIND Families WHERE Families.Attibute=XYZ
GroupCreation
Code: Select all
CREATE Group with ....
When you call a sub process it will receive only one of the instances of each of the input BOs allowing unitary actions to execute with just one BO in context. Once it has completed the first instance of Families it will then run for the next in context until the list of BO instances in context is exhausted. The process will then move onto the next step in the original process (FindFamilies in your case).
Bear in mind that things you create in downstream processes (Groups in this case) are no longer in context once that sub process has ended, if you need them all later you'd need to do another FIND.
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Updating linked BO through process.
THIS THAT and THOSE are for use when you can't avoid having two instance of the same BO in context, but I tend to use sub processes to keep contexts clean and use a temporary BO to pass things back and forward between sub processes allowing me to create a hook that I can pull BOs back from sub processes back to the parent process, but that is a more complex discussion.srufini wrote: What I found is, no matter what I use, IF, FIND,, the context within this process will always be locked on the first family that is created in the first rule. If I use "That" will be recalled the second one.