Mule targeting where ForEach puts values - foreach

Is there some way to target where a ForEach scope puts the value instead of the payload, much the way you can with an enricher? I can't find any doc on this but thought I'd ask.
The use case is that I have a list of email addresses in a flow variable. I want to email the payload coming into the flow to each addressee individually. If I use a ForEach loop, I'm having to "switch in" the payload like this:
<set-variable variableName="emailBody" value="#[payload]"/>
<foreach collection="#[flowVars['mailTo']]">
<set-variable variableName="addressee" value="#[payload]"/>
<set-payload value="#[flowVars['emailBody']]"/>
<!-- send the message here based upon the 'addressee' flow variable-->
</foreach>
Is there some way that each value of the iteration could be placed someplace other than the payload? Or, am I approaching this all wrong?
Mule 3.3.1

If you want to access the particular item in the collection (in the payload) in the current collection then just access that item using this property of the for each
counterVariableName="counter"

Related

How to get in-place archive custom folder name on office 365?

GET mailFolders/archivemsgfolderroot
I use distinguish name to get this in-place mailbox folder
and the response is:
...
"displayName": "Top of Information Store",
...
However, this is not the custom name I modified on office365.
Is it possible to get that custom name?
I also try to get distinguish folder in EWS managed API
<t:DistinguishedFolderId Id="archivemsgfolderroot" />
It returns the same name
...
<t:DisplayName>Top of Information Store</t:DisplayName>
...
--
Add two image ref.
how I add it
how it looks like at outlook
thanks for help
I see that a user can set a property, "ArchiveName", to give their archive mailbox a custom name. In powershell, this would be using a Set-Mailbox cmdlet.
https://learn.microsoft.com/en-us/powershell/module/exchange/mailboxes/set-mailbox?view=exchange-ps
That doc states that it applies to Outlook and OWA and, after a quick look, I can't see a way to get that property other than using Get-Mailbox which is not ideal. So as best I can tell it's not exposed through EWS or REST and thus probably isn't available through Microsoft Graph.
I would encourage you to file a suggestion: https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/category/101632-microsoft-graph-o365-rest-apis
You can try the following endpoint
https://graph.microsoft.com/v1.0/me/mailFolders/archivemsgfolderroot/childFolders/AAMkADQ5OWMzMGEwLTg4ZjktNDk1Ny05NzFmLWRhZjg4ODU0YzUwYwAuAAAAAACtqDzk9UzLSpZsdesjndr1AQBNzq1HG8BvRYqBQbPeZSPaAAGdwZCCAAA=
(Replace the id to yours):https://graph.microsoft.com/v1.0/me/mailFolders/archivemsgfolderroot/childFolders/id

Umbraco: custom member types using config file

I am creating member type using config file as below:
<membertype alias="custommember" name="Custom Member">
<tab alias="general" name="General Details">
<property alias="contactphone" name="Contact Phone Number" type="Umbraco.Textbox" datatype="nvarchar" description="Either Mobile or Landline. If a mobile is enters SMS notifications are provided"/>
<property alias="emailaddress" name="Email Address" type="Umbraco.Textbox" datatype="nvarchar" description="The primary contact email address of the member" />
</tab>
i am trying to add validation property in phone and email address, any idea which property i need to call?
like for phone only number are allowed and for email : 11xx#xx.com only this format allowed.
Thanks
You can create custom member types (or edit the default) directly inside Umbraco 7, you don't have to do it through a config file. Inside Umbraco there's a validation field and everything.
Under Members, right click Member Types, choose Create, and voila :-)
If nothing else, you might be able to spot what changes (if any, but I don't think config files are used anymore) are made to config files when you create a custom membertype inside Umbraco, and use those changes elsewhere.

xpages reader field with - read only type

I have question:
My xpages contain a field that contain creator of document.
The issue is:
When ReadOnly field is Enabled, the agent can't get value of the field from context.
I want user can't change the value of the field
How to solve it?
Note: there a button that will call the agent to process the context
Thank you for your help
Why not to use the disable property of the inputText? And with a little help of CSS the result might be just fine:
<xp:inputText id="inputText1"
style="background-color:none;border:none;background: transparent"
disabled="true">
....
</xp:inputText>
Or you can compute the disable property:
<xp:this.disabled><![CDATA[#{javascript:if (currentDocument.isEditable())
return true;}]]></xp:this.disabled>
Hint: I recommend to create a .css file and write there all the properties. Then just import the file to the respective xpage/custom control and specify the class in the Style property of the field.
First of all: it isn't very clear what you want to do. You have a field with the creator of a document and you speak of an agent. A few pointers:
Never try to process UI elements. Always go after the data model, the bound data.
Displaying a username doesn't write it back anywhere, you need to take a different action. Add to the "post new document" event something like:
var creator = document1.replaceItemValue("Creator",#UserName);
creator.setAuthors(true);
(above is off my head, might contain typos). Then the value is in the document, you can use it in a computed field and hand it over to an agent (which I wouldn't do, convert your agent code to Java and clean it up while you are on it).
Do you mean something like this?
<xp:inputText id="inputText1" defaultValue="test">
<xp:this.attrs>
<xp:attr name="readonly" value="true"></xp:attr>
</xp:this.attrs>
</xp:inputText>

In IBM WCS, what happens when a user logs in after adding an item to cart as a guest. How is the orderId handled in this scenario?

I need to know more on the back end flow, when a user adds an item to cart as a guest and the logs in using his valid credentials. The orderId created for the guest gets migrated to the registered user's id. Could someone please explain how this is handled ? Details of the commands and DB tables would be helpful.
I did read about a MigrateUserEntries Command but I am not sure if that is the correct one.
Thanks in advance.
When a guest user logs in, his cart gets merged with the cart of the registered user account.
This impacts the tables related to order and order items.
You can look at the documentation of OrderCopy for more details.
But the Trick here is :-
public class MigrateUserEntriesCmdImpl
extends TaskCommandImpl
implements MigrateUserEntriesCmd
This task command is used to migrate resources owned by one user to another. The mandatory resources that are migrated are Addresses, Current Orders, Interest Items, Order Items, Orders, and Order templates.
By default, this command will not merge the shopping cart for the 2 users, but it can be configured to do so by:
a) Setting the mergeCart flag in the request property in the command context to true.
OR:
b) Setting MemberSubSystem/MergeCartsAtAuthentication/enabled in the wc-server.xml to true.
The mergeCart flag in the request property will take higher priority.
Before executing this task command the following sets should be performed:
setOldUser() -->getOldUser()
This method retrieves the old user whose resources are to be migrated to the new user.
setNewUser() -->getNewUser()
This method retrieves the new user who is the recipient of migrated resources from the old user.
These both OldUser and NewUser will be able to retrieve from UserAccessBean of concern JSP.
migrateOrderItem(OrderItemAccessBean abOrderItem, UserAccessBean abNewUser, CommandContext newUserCmdCtx)
This method migrates an order item to a new user.
First, some review about User lifecycle in WCS commerce :
1- user visited the site as generic user with USER ID = -1002
2- when user add any item to his shopping cart , WCS create an OrderId and assign it to new USER ID created and user called "guest" in this case
(both #1 and #2) have userType=G
3- when user log in using login form it is by default attached to LogonCmd in struts configuration , and if you decompile that controller command you will see that it is calling MigrateUserEntriesCmd task command which responsible for migrating Addresses, Current Orders, Interest Items, Order Items, Orders, and Order templates.
the new orderID that is used is the Registered OrderId .
I suggest you use decompiler installed to your RAD so you can decompile IBM classes for better understanding of the logic and then customize your code as IBM best practice (extending commands .. etc )
I use JAD eclipse plugin for decompilation .
you can further read (references):
http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.commerce.admin.doc%2Fconcepts%2Fcmsmembers.htm&resultof%3D%2522%2555%2553%2545%2552%2553%2522%2520%2522%2575%2573%2565%2572%2522%2520
http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.commerce.api.doc%2Fcom%2Fibm%2Fcommerce%2Fsecurity%2Fcommands%2FMigrateUserEntriesCmdImpl.html
Thanks
Abed
In login page add this code when user Guest and OrderItemMove is out of box command used
<pre>
<c:if test="${userType == 'G'}">
<wcf:url var="orderMove" value="OrderItemMove" type="Ajax">
<wcf:param name="toOrderId" value="."/>
<wcf:param name="deleteIfEmpty" value="*"/>
<wcf:param name="fromOrderId" value="*"/>
<wcf:param name="continue" value="1"/>
<wcf:param name="createIfEmpty" value="1"/>
<wcf:param name="calculationUsageId" value="-1" />
<wcf:param name="calculationUsageId" value="-2" />
<wcf:param name="calculationUsageId" value="-7" />
<wcf:param name="updatePrices" value="0"/>
</wcf:url>
</c:if>
</pre>
Button javascript code User clicks on :
LogonSubmit(document.Logon,'<c:out value='${orderMove}'/>','<c:out value='${afterOrderCalculateURL}'/>');void(0);">
After validation and form the URL
function LogonSubmit{
var completeOrderMoveURL = orderMoveURL;
completeOrderMoveURL = completeOrderMoveURL + "&URL=OrderCalculate?URL=" + afterOrderCalculateURL +"&calculationUsageId=-1&calculationUsageId=-2&calculationUsageId=-7";
document.getElementById('URL').value = completeOrderMoveURL;
}
//Then submit the form
form.submit();
I hope this Help for merging the items after login

How to Query Sales Order by Order Number?

I've gotten frustrated with the .NET DevKit and am now considering switching my app over to XML. But I'm still having trouble figuring out how to perform very basic queries.
How can I retrieve a QBD Sales Order by the order number? This is the "Sales Order Number" in the QBD UI, "RefNumber" in the SDK, and "DocNumber" in IPP.
Just in case somebody needs me to explain the use case for looking up a record by the human-readable unique ID: I'm integrating with a system where we don't have the luxury of storing a QB transaction ID after importing a sales order. So if that system wants to query QB later to check the status of a sales order, it needs to do so by that system's unique order #.
I already have links to all the documentation; thanks. I just need to know how to perform this query. Similarly, I need to do it for Invoices and POs.
I need the same thing for Items, the use case being that if we're importing items from another system, we need to query the QB item list by name to see if we already have that item in QB.
For ITEMS, you can use ItemConsolidated and a NameContains filter. For example, the XML would look something like:
POST https://services.intuit.com/sb/itemconsolidated/v2/<realmID>
...
<?xml version="1.0" encoding="UTF-8"?>
<ItemConsolidatedQuery xmlns="http://www.intuit.com/sb/cdm/v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.intuit.com/sb/cdm/v2 RestDataFilter.xsd ">
<NameContains>Your item name goes here</NameContains>
</ItemConsolidatedQuery>
It won't be perfect, because Intuit only supports "NameContains" (the item name contains the string you specify) rather than "NameEquals", but you can then loop through what you get back and filter it client-side from there.
For SALES ORDERS, unfortunately, Intuit Data Services doesn't support querying by DocNumber at this time.
Instead, a work-around for your situation might be to query for all sales orders, and then cache the Id and DocNumber value of each in your application. When you need to look something up, look up the Id in the cache, and then query by Id value. It's not pretty... but it's really the only way you can do what you're describing.

Resources