MS CRM Email multiple recipients throught WebService - web-services

I'm trying to create Email in MS CRM 2011 throught REST WebService. I can create Email activity and even recipients (from, to, cc, bcc) by creating ActivityParty. All works great, until I try to create Email with multiple recipients – there is always only last recipient created. I googled a lot, and figured out, that CRM always delete previous and create new one, if created throught REST. So I'm asking: Is here any chance to create multiple recipients throught SOAP by JavaScript? Either when Email entity is created, or after, straight by creating multiplle ActivityParty entity?
Thanks for any suggestion or link to resource

You need to use the email_activity_parties property and pass it an array of activity parties.
var activityParties = new Array();
var p1 = new Object();
p1.PartyId = { Id: userid, LogicalName: "systemuser" };
p1.ParticipationTypeMask = { Value: 1 };
activityParties[0] = p1;
var p2 = new Object();
p2.PartyId = { Id: contactid1, LogicalName: "contact" };
p2.ParticipationTypeMask = { Value: 2 };
activityParties[1] = p2;
var email = {
Subject: "Test this be",
Description: "Yo",
email_activity_parties = activityParties
...
Then use the email object in createRecord.

Related

Sitecore EXM 3.2(ECM) Assign goal to the triggered message

I need to do a simple newsletter form. This form should work like this:
User inputs an email and presses to the submit button
User recieves message on email with confirm link
After user clicks on the link his email is added to Recipient list
This form should be work with help EXM
I've created Triggered message in the EXM with link for subscription.
And I wrote this code for the Submit button for trigger the Newsletter Goal
[HttpPost]
public ActionResult NewsletterSubscribe(NewsletterViewBag model)
{
var goal = Context.Database.GetItem(newsletterGoal);
if (goal == null)
{
continue;
}
var registerGoal = new Sitecore.Analytics.Data.Items.PageEventItem(goal);
var eventData = Tracker.Current.CurrentPage.Register(registerGoal);
eventData.Data = goal[DateTime.Now.ToString(CultureInfo.InvariantCulture)];
Tracker.Submit();
}
How I can assign my triggered message to the newsletterGoal?
Also I try manually send message this way:
MessageItem message = Sitecore.Modules.EmailCampaign.Factory.GetMessage(new ID(messageId));
Sitecore.Modules.EmailCampaign.AsyncSendingManager manager = new AsyncSendingManager(message);
var contactId = ClientApi.GetAnonymousIdFromEmail(email);
var recipientId = (RecipientId) new XdbContactId(contactId);
manager.SendStandardMessage(recipientId);
And I see error in the log: The recipient 'xdb:857bbea1-1f18-4621-a798-178399cd0b54' does not exist. But Triggered Message haven't any recipient list
Goals are not assigned directly to messages. You can, however, assign engagement plans and campaigns. Each message has its own engagement plan to handle tracking the contacts actions with the message. If you create a campaign that triggers a goal, you can assign that to the message and it will be associated with the contact when they receive the message. You can also leverage the message engagement plan to trigger events as the contact proceeds through those states.
Also, you're missing some details while recording the contact data.
Look at the newsletter signup control that is included in the EXM module. The important part in there is this:
protected virtual RecipientId RecipientId
{
get
{
RecipientId recipientId = null;
var contactId = ContactId;
if (contactId != (ID)null)
{
recipientId = new XdbContactId(contactId);
}
return recipientId;
}
}
protected virtual ID ContactId
{
get
{
if (!Email.Visible || string.IsNullOrEmpty(Email.Text))
{
return new ID(Tracker.Current.Contact.ContactId);
}
var anonymousId = ClientApi.GetAnonymousIdFromEmail(Email.Text);
return anonymousId.HasValue ? new ID(anonymousId.Value) : new ID(Tracker.Current.Contact.ContactId);
}
}
protected virtual void UpdateEmailInXdb()
{
_recipientRepository.UpdateRecipientEmail(RecipientId, Email.Text);
}
It will write the email address directly to Mongo, rather than waiting for the session to end. Include this and the related RecipientId and ContactId properties in your signup code.
Once they are signed up you can register the goal programmatically or send them to a Thank You page where the goal can be registered (Advanced - Tracking), or send the message and let that register the goal. Or create an engagement plan with states for each step of the process (this is the best way).
You'll also want to add the recipient to a list that the newsletter message can use later. Actually, it looks to me like the example Subscription Form does everything you need.

Custom Clearence Detail and PuposeOf Shipment Type Object in Fedex Web Services

I am Trying To Use Fedex Web Service For Getting their For Services From an Indian Address To Indian Address. But Iam Not Getting A Right Reply Object in Get Fedex Rate Function
Error that I Am Getting is ......Object Refencence Can Not Be Null
They Are Showing Two Objects Their.One Is CustomclearenceDetail and Other Is Purpose Of ShipmentType.
my SetShipmentDetails Function Is Like This..
private void SetShipmentDetails(RateRequest request)
{
request.RequestedShipment = new RequestedShipment();
request.RequestedShipment.PackagingType = PackagingType.YOUR_PACKAGING;
request.RequestedShipment.PackagingTypeSpecified = true;
request.RequestedShipment.DropoffType = DropoffType.REGULAR_PICKUP;
request.RequestedShipment.DropoffTypeSpecified = true;
request.RequestedShipment.CustomsClearanceDetail.CommercialInvoice.TaxesOrMiscellaneousChargeType = TaxesOrMiscellaneousChargeType.TAXES;
SetOrigin(request);
SetDestination(request);
SetPackageLineItems(request);
request.RequestedShipment.RateRequestTypes = new RateRequestType[2];
request.RequestedShipment.RateRequestTypes[0] = RateRequestType.PREFERRED;
request.RequestedShipment.RateRequestTypes[1] = RateRequestType.LIST;
request.RequestedShipment.PackageCount = "1";
}
There Was A Proble That I Was Not Creating A New Instance Of Objects I Want To Use Here..By Creating A New Instance This Problem Will Be Solved.

Posting on user's wall doesn't fail but doesn't who either

I'm having an issue where I'm posting a new message using facebook SDK 6.0 with:
var client = new FacebookClient("<target users access token>")
{
AppId = "<my app id>",
AppSecret = "<my app secret>"
};
var args = new Dictionary<string, object>
{
{"message", "A message",
};
dynamic postResult = client.Post("/me/feed", args);
The interesting part is that the postResult has an id property, but the message doesn't appear on the users feed/wall. Using the API to get all feeds doesn't return the post and manually viewing it using https://graph.facebook.com/[message_id] simple returns "false".
I've tried this with sandbox mode on and off and it makes to difference.
Any ideas on what I've done wrong?

How to retrieve request info by request id?

When I invite my friends I get back request_ids. After that I proceed those ids to get info about users invites have been sent to and create records in my database based on user's public profile info. But when I try to get request info by request id I get error message saying "Unsupported get request" nevertheless access token is fine.
// create data object to be sent to FB API
var data = new Object();
data.method = 'apprequests';
data.message = MESSAGE_TEXT;
data.display = 'iframe';
data.access_token = ACCESS_TOKEN;
data.show_error = 'Yes';
data.title = TITLE_TEXT;
// call FB API
FB.ui(data, function(aResponse)
{
var request_ids = '';
if (aResponse && aResponse.request_ids)
request_ids = aResponse.request_ids.join(',');
if (request_ids)
{
// send request_ids string to my server for further processing
}
});
Example of such broken request id: 1930910810837. Trying to get info for it like this:
https://graph.facebook.com/1930910810837?access_token=ACCESS_TOKEN
Please help me understand what is wrong. May it be issue on Facebook side, for example, Facebook returned broken id for some reason? Thank you!!!

How do I connect to a CRM IFD web service?

I have taken the code from the SDK and made just one modification to set the authentication type but when I try to connect I get an "Unauthorized" error.
My code is:
// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 2;
token.OrganizationName = "TESTCRM";
CrmService service = new CrmService();
service.Url = "https://testcrm.ifdtestsystem.com/MSCrmServices/2007/CrmService.asmx";
service.CrmAuthenticationTokenValue = token;
//service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Credentials = new NetworkCredential("Bill", "Password");
// Create an account entity and assign data to some attributes.
account newAccount = new account();
newAccount.name = "Greg Bike Store";
newAccount.accountnumber = "123456";
newAccount.address1_postalcode = "98052";
newAccount.address1_city = "Redmond";
// Call the Create method to create an account.
Guid accountId = service.Create(newAccount);
When using SPLA (IFD) you need to also populate the token with a crmticket.The ticket can be retrieved by quering the CrmDiscoveryService.
This document contains a reasonable sample how to use CrmDiscoveryService to obtain a ticket and set up CrmService.
Note that Credentials property for the service will no longer be required as all authentication information will be inside the ticket.
Hope this helps