Skip to main content
Nintex Community Menu Bar

Good day.

 

I'm sure I'm doing something really wrong...and this is not the first time it's happened to me....but I'm pulling my hair out.

 

I have a simple workflow that is using the Exchange Mailbox Service custom service broker to go out to a shared mailbox and list all the emails in the box.  Checking the broker in the Smart Object Service Tester, it works perfectly!  

 

So, in my workflow, I start with a create reference event, using the method "List Inbox Emails"

 

Then I use a For Each event to start a process to take each email in the list and write the data to my database using a Smart Object event create method

 

The problem is that when it writes to the Database table, it's putting the data for multiple records in the column of a single record.  So, for example I would expect to see for the first 5 records the Subject column to show:

 

Disclosure statement attached

July production numbers

Task Completed

Opportunity completed

Onsite visit tomorrow

 

Instead I see 5 records with the subject column of:

 

 

Disclosure statement attachedJuly production numbersTask CompletedOpportunity completedOnsite visit tomorrow

Disclosure statement attachedJuly production numbersTask CompletedOpportunity completedOnsite visit tomorrow

Disclosure statement attachedJuly production numbersTask CompletedOpportunity completedOnsite visit tomorrow

Disclosure statement attachedJuly production numbersTask CompletedOpportunity completedOnsite visit tomorrow

Disclosure statement attachedJuly production numbersTask CompletedOpportunity completedOnsite visit tomorrow

 

I'm attaching a document with a bunch of screenshots of my workflow.  

 

Help is appreciated. 🙂  

 

 

From the Screenshot attached, it looks like you had specified 'MailBoxEmails3' as the collection of items, and 'MailBox Emails 3 Ref' as the single item.


 


In the create method, it looks like you are using the collection 'MailBoxEmails3'  field instead of the single item 'MailBox Emails 3 Ref' field.  Perhaps try 'MailBox Emails 3 Ref.Subject' to see if this resolves your issue.


Hi there.

 

So, I double checked (I've re-done this thing like 5 times always with the same result) and it's still doing the same thing.  

 

Is there a possibility that the list method smart object I'm trying to create a reference from has some kind of issue?  When I run it in the SM Service Tester, it gives me a nice neat list...

 

This is VERY frustrating.  

 

Has anyone ever had this happen?

 

Rob

 


Hi,


 


I tried creating the same workflow and I am facing the same problem as well. I managed to get around this by making some modifications:


 


1. In the For Each event, I directly map the Source to the SmartObject method, and more specifically, only list out the ItemId property.


 



 



 



 


2. In the Next step, I add a Create Reference event, which maps to the MailboxEmails Read method. The Read method is configured to use the ItemId from the Item Reference configured in the For Each event.


 



 



 


3. After the Create Reference event, the SmartObject event, which calls the your Create method, will use the reference from the previous Create Reference event to write data into the database.


 



 


4. It should look like this when you are done:


 



 


So with this, you will have to call the MailboxEmails SmartObject multiple times, once to obtain the list of ItemId, the subsequent steps to call the Read method to obtain the individual email.


Wow.  That looks really good.  I'll try it.

 

Seems weird that it doesn't work the other way, doesn't it, though?

 

Rob

 

 


It worked!  Thanks so much.

 

Rob

 


One other thought.  What would happen do you think if the email box received a new email while this workflow was running?  Would it pick it up?  Or would it get picked up the next time the workflow runs?  What if an email gets deleted from the box when the workflow was running?  

 

 

 

Rob

 

 


If a new email comes in while the workflow is running, that new email will not be picked up by the workflow. The solution I posted previously will first obtain the list of email IDs, and then loop through each of that ID. So that means if new emails arrive after the loop has started, the new email will not be picked up.


 


Deleting email is a little complicated. If you delete the email after the workflow has processed it, nothing will happen. The workflow will have already written that email data into your database. However, if you deleted the email before the workflow processed it, the workflow might return an error, since it cannot retrieve that email from the email ID.


 


If you want to delete emails, maybe add a event that deletes the email after it has been processed. K2 should have a service broker out of the box that allows you to do that.


Reply