I have a Process that does a CREATE BusinessObject, in this case:
CREATE DummyIncoming..... This works.
I then do a FIND SendMemberMessages WHERE SendMemberMessages.ID=ThisDummyIncoming.MessageID
In the tomcat log I see this below:
Unable to find ThisDummyIncoming.MessageID in query FIND SendMemberMessages WHERE SendMemberMessages.ID=ThisDummyIncoming.MessageID
I am thinking that ThisDummyIncoming is the wrong context.
I know that DummyIncoming records are getting created properly because I can search them in "Search Objects"
Dave
What is the context after a CREATE object? (SOLVED)
What is the context after a CREATE object? (SOLVED)
Last edited by ddumas on Tue Dec 10, 2019 2:00 pm, edited 1 time in total.
Re: What is the context after a CREATE object?
Hi ddumas
this = input object
that=found object
You can just try "FIND SendMemberMessages WHERE SendMemberMessages.ID=DummyIncoming.MessageID"
That's what I'd do anyway.
this = input object
that=found object
You can just try "FIND SendMemberMessages WHERE SendMemberMessages.ID=DummyIncoming.MessageID"
That's what I'd do anyway.
Re: What is the context after a CREATE object?
If you just did a create, or enter new, the record is in context immediately after that statement.
The “ this “ is totally wrong here. No need.
The “ this “ is totally wrong here. No need.
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
Re: What is the context after a CREATE object?
I just attached a screenshot...
- Attachments
-
- FindMessage.PNG (59.42 KiB) Viewed 8553 times
Re: What is the context after a CREATE object?
That looks fine. You do know that you are finding a record, and doing nothing with it? FIND doesn't show you any results, it just puts the object(s) in context.
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: What is the context after a CREATE object?
Unclear what your business model looks like, but what are the attributes of DummyIncoming, I noticed that there is a MessageID attribute. How is that being populated and are you sure that it has a value? Is it an integer or a typo to Message.ID?
Re: What is the context after a CREATE object?
Yes, It was created by AwareIM as a number, and AwareIM creates numbers as bigint in MSSQL, and in this case populated with a 5. I CREATE that object just before the FIND in my screenshot. I show DummyIncoming in the app, with Search Objects, so I can see its indeed populated with a 5, so I am positive that the DummyIncoming record is there with that value. Also SendMemberMessages has a record with a 5 in it's ID. So there is a perfect match in the database.
The only "wrinkle" is that these business rules CREATE and FIND exist in an IncomingEmail Notification. But a Notification allows business rules in it, so it should work. I am now going to try moving the IncomingEmail Notification business rulesto a PROCESS, pass IncomingEmail as an input to that process, and see it that works. I should not have to do that, but will try and let you know.
Dave
The only "wrinkle" is that these business rules CREATE and FIND exist in an IncomingEmail Notification. But a Notification allows business rules in it, so it should work. I am now going to try moving the IncomingEmail Notification business rulesto a PROCESS, pass IncomingEmail as an input to that process, and see it that works. I should not have to do that, but will try and let you know.
Dave
Re: What is the context after a CREATE object?
I moved the Business rules to a PROCESS called by IncomingEmail, and same error result in tomcat log:
"Unable to find DummyIncoming.MessageID in query FIND SendMemberMessages WHERE SendMemberMessages.ID=DummyIncoming.MessageID"
I do see that whenever I save the Business Rule in the IncomingEmail notification, I get this attached popup dialog. I get this with the FIND as a Business Rule embedded in the IncomingEmail notification, or the FIND as a Business Rule embedded in the ProcessIncommingEmail PROCESS .
So, the context is indeed getting lost. Frustrating.
Dave
"Unable to find DummyIncoming.MessageID in query FIND SendMemberMessages WHERE SendMemberMessages.ID=DummyIncoming.MessageID"
I do see that whenever I save the Business Rule in the IncomingEmail notification, I get this attached popup dialog. I get this with the FIND as a Business Rule embedded in the IncomingEmail notification, or the FIND as a Business Rule embedded in the ProcessIncommingEmail PROCESS .
So, the context is indeed getting lost. Frustrating.
Dave
- Attachments
-
- ConfirmChanges.PNG (75.64 KiB) Viewed 8536 times
Re: What is the context after a CREATE object? (SOLVED)
So, this was interesting.
I watched the video on context. Mandatory Video.
I learned:
Business Rules do NOT execute in any particular order, so forget about CREATEing a record in a business rule and then expecting the next Business Rule to use the context of an object in a previous rule.
Business Rules are "triggered" on a BO as the BO is created, modified. Use Business Rules to validate, and populate data. Do not use Business rules to "Do" something
Use a Process to "do" something.
Here is what I did that worked:
In the IncomingEmail notification Business Rules, I CREATE the DummyIncoming BO. That's it, no other rules.
Then in the DummyIncoming BO, I created a business rule to RUN PROCESS ProcessIncomingEmail USING DummyIncoming
Then in the ProcessIncomingEmail Process, since I have DummyIncoming as an input, I have it's context
I then FIND SendMemberMessages WHERE SendMemberMessages.ID = DummyIncoming.MessageID
Since a process runs it's business rules in sequence, I can then do anything I want, FIND, CREATE, etc and the Context will not be lost for anything.
In summary, Process is KING!
Dave
I watched the video on context. Mandatory Video.
I learned:
Business Rules do NOT execute in any particular order, so forget about CREATEing a record in a business rule and then expecting the next Business Rule to use the context of an object in a previous rule.
Business Rules are "triggered" on a BO as the BO is created, modified. Use Business Rules to validate, and populate data. Do not use Business rules to "Do" something
Use a Process to "do" something.
Here is what I did that worked:
In the IncomingEmail notification Business Rules, I CREATE the DummyIncoming BO. That's it, no other rules.
Then in the DummyIncoming BO, I created a business rule to RUN PROCESS ProcessIncomingEmail USING DummyIncoming
Then in the ProcessIncomingEmail Process, since I have DummyIncoming as an input, I have it's context
I then FIND SendMemberMessages WHERE SendMemberMessages.ID = DummyIncoming.MessageID
Since a process runs it's business rules in sequence, I can then do anything I want, FIND, CREATE, etc and the Context will not be lost for anything.
In summary, Process is KING!
Dave