Need advice for Context in a Process [Solved]

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Andrea
Posts: 45
Joined: Mon Nov 02, 2009 3:41 pm
Location: Calgary, Alberta

Need advice for Context in a Process [Solved]

Post by Andrea »

I have a BO (Import.BO) that I use to hold imported data that I want to link to an existing BO (Contact.BO).

I have a process that inserts the Contact.BO to the Import.BO (1:1 relationship) that works only when I run it from an individual Import.BO record.
“InsertContact” Process code:
FIND Contact WHERE Contact.Email=Import.Email
INSERT Contact IN Import.ContactLink

I thought if set up a process like below I could run the InsertContact Process on all the Import.BO records.
Mulit_Insert Process code:
FIND Import WHERE Import.State=‘existing’ IN BATCHES OF 1
InsertContact (process above)

But the log is telling me that “Value of the attribute Email of object Import could not be resolved”.

I’m obviously missing a step that puts the record in context. I tried using “ThisImport.Email” and “ThisContact” with no luck.

What I’m I doing wrong?
Last edited by Andrea on Tue Jun 30, 2020 4:00 pm, edited 1 time in total.
Andrea
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Need advice for Context in a Process

Post by Jaymer »

Hi Andrea in Canada - nice to hear from you - glad you're still around!

So I think its telling you that because there is no instance in context.
Is this immediately after the import? if so, a COMMIT TRANS... will help as those recs may not be posted yet.

And if its a standalone process, then try removing the IN BATCHES OF 1 and just call a "_b" process with IMPORT as Input, and it will feed all the found Import recs to the child process.
The logger will then show ID #s of the eligible recs (and the FIND will show a count) and you'll see more about whats happening (or not) behind the scenes.
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
Andrea
Posts: 45
Joined: Mon Nov 02, 2009 3:41 pm
Location: Calgary, Alberta

Re: Need advice for Context in a Process

Post by Andrea »

Hey Jaymer, yes I'm still here :D

I've set up my import so that it dumps to a BO so I can clean up the data and run some processes before I either create a new Contact or modify an existing Contact (the data contains a mix of both). So yes, the records are there. I want to insert the matching Contact (based on email address) to the Import.BO to create the relationship so that I can compare/modify the records and create child records for the Contact based on the Import.BO record. (The Import.BO record contains data for the Contact and for the creation of a child record for that Contact).

If I open an Import.BO record and run a process to insert the Contact it works. If I run a stand-alone process to find each Import.BO record and run the insert Contact process, it doesn't work.

The IMPORT suggestion is interesting. Are you saying that I should connect the Contact I'm trying to find when I import the data to the Import.BO? I was hoping to connect after my data was imported and cleaned up, hence the "temp" Import.BO

I thought this would a simple process to write...nope :wink: Is there any other way to do what I want to do?

Thanks for your help on this :D
Andrea
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Need advice for Context in a Process

Post by Jaymer »

will be able to help you knock this out with a skype or zoom call on Tue.
skype: JaymerJaymer or email zoom invite to jaymer at me.com
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
ACDC
Posts: 1138
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: Need advice for Context in a Process

Post by ACDC »

Code: Select all

I thought this would a simple process to write...nope
A simple way to do this is to leverage object rules to achieve the objective. This way you can guarantee context is always in place and also lock down a failure unique to one record as opposed to the whole process aborting

So instead of starting off with a process, rather create a rule on the IMPORT object using IF Object IS NEW. When the import object is created, the rule will be fired linking your Contact object based on your Object rule criteria. (sometimes depending on the objective and complexity you may have to refer to a process in your Object rule. )

I have some very complex Import routines that rely on a business rule taking over from the initial object creation, in some cases initiating the creation of other new objects which in turn fire similar object rules achieving a formidable result . :)
Andrea
Posts: 45
Joined: Mon Nov 02, 2009 3:41 pm
Location: Calgary, Alberta

Re: Need advice for Context in a Process

Post by Andrea »

Thanks Jaymer - I will reach out to you today.

ACDC - That's a great tip. I was trying to use business rules after the data was imported, not during importing/creation. Sounds like that is the better way to go. Thank you
Andrea
Andrea
Posts: 45
Joined: Mon Nov 02, 2009 3:41 pm
Location: Calgary, Alberta

Re: Need advice for Context in a Process [Solved]

Post by Andrea »

Apparently I've been surviving all these years without using the feature of "input" in a process. Jaymer introduced me (thank you). Glad it was something simple :) Now to put my new knowledge to work.
Andrea
Post Reply