Hi,
I have a record list. I want the record list to be mailed using “pub.client:smtp”. When I use loop in the body(serviceIn of pub.client:smtp), i get nothing, just the text as I typed in there.
Is there a way to do this.
Also please let me know how can I format the email. Can I pass html in the body?
In either case, the output is your record converted to a string.
Then, using pub.client:smtp, you can map the xmldata string to the body field, or you can map it to the attachments array below into the content object. Set the content type, filename appropriately.
Actually i got this idea earlier itself,but based on your requirement i have tried to convience the same,since you wants to use from %RecordDetails% variable itself.
Hi Ray,
I followed your steps and getting the results. But the problem is that I can’t directly map the xmldata string to the body field because I have also some other record structure to which I have to set the value to that body field of pub.client:smtp.
I used %xmldata% in the body and checked the variable substitution, but the output is “%xmldata%” and not its results.
That’s not a problem. If you already have a field mapped to the BODY field, then here is a way to get both pieces of data in there:
Insert a map step above the call to the SMTP service or anyplace convenient. I usually call it mailBody.
When you set the mailBody field, take the first string that you are mapping currently to the body field of the SMTP service, call it myField, and using large editor (right mouse click on the setValue box and choose large and it opens up a notepad looking box) insert the field:
%myField%
%xmldata%
NOTE: I am using carriage returns so that the data is not clumped together.
Then, once this is complete, step through the service to make sure that the field contains data formatted properly. Don’t forget to map the new mailBody field to the body field of SMTP.
This is simple substitution and really easy to do. But, keep in mind that you need to comment your maps carefully or you will be hunting for this later on when you want to make a change.
H Ray,
Thanks for reply. I took the steps you told, but still one problem. Not getting xmldata in the output. Just getting the same as I typed,
%xmldata%.
I looped over Items. OutArray is xmldata. Then under that loop, used documentToXMLString and mapped those Items record to the document (input of documentToXMLString) and getting array of string as xmldata.
IF you are seeing the data in “xmldata” variable which is the output of the documentToXMLString,then %xmldata% with variable substitution ON should work fine.
Please check the pipeline results while step thru before setting
%xmldata% substituion in the email body,whether the data exists or null.(debug the problem)
yes, I can see the data in the xmldata string. All item data is there but when I use %xmldata% in the mailBody, it shows nothing. May be, xmldata is a String array and there must be some problem in looping
I believe it doesn’t matter with array problem or string array,as long as xmldata holds the data and with variable substitution it should appear in the body.
Ok try with documentToXMLString moving outside the loop and check the xmldata.(instead you said —under that loop, used documentToXMLString)
IF possible can you post your “xmldata” in your next message.
Map the xmldata field to something else, like stringXML. Then use the new variable. xmldata is a keyfield or term in webMethods so this could be a problem (see $xmldata).
Map the new string into the string substitution that you did before. If the first string is making it but xmldata is not, then this will probably solve the problem. Step through the flow, if you can see the new string populated properly, then it should work.
I don’t know why xmldata will not populate for you, but try to see if this will work for you.
I strongly suspect that you haven’t checked the “VariableSubstituion” (Checkbox)on the setValue box.
And use the using large editor (right mouse click on the setValue box and choose large and it opens up a notepad looking box) insert the field: %xmldata%.
Please make sure these above steps.Its fair simple.
OK i dont want to mess up the output.
And I strongly suspect that you might have missed to check the “VariableSubstituion” (tick the Checkbox)on the setValue pop-up box.which will show the result data (%xmldata%).
First of all, I am getting a String array as xmldata.
As Ray suggested, I map it to some other string field named StringXML. By doing this, I can get only the first item detail in the email and not all.
One thing I want to mention here. xmldata is a string array. When it is used directly in the mailBody as %xmldata%, it outputs nothing. But when I map it to some string(not an array string) and then use that string in the mailBody, it outputs only first item detail.
All things are ok but I dont know why its not getting the output in the email.
One more suggestion i have is --once your final record list is build then, come out of the loop and invoke documentToXMLString (provide the documentType,so that it will use reference and build the xmldata) which should give the xmldata that contains all the (iteme details) and then set this %xmldata% in the email body with variable substitution ON.