If you have a need to use PowerSMS using Microsoft Dynamics 365’s SDK (such as a console app), this can be easily achieved. There are only a couple things to double check when sending SMS messages with PowerSMS using Dynamics 365’s SDK and today’s blog will walk you through it!

Sending SMS Messages with PowerSMS Using Dynamics 365’s SDK

Let’s say for example that your users are required to record their time cards everyday by midnight. Time cards are tracked with an application outside of CRM, and this application isn’t integrated with CRM. In order to help users meet this requirement, you want send an SMS message to those who have not yet entered their hours at 9:30pm each day.

In order to achieve this, you will need to create an EntityCollection, DataTable, or other type of enumerable object which includes a Mobile Number as well as any other fields you want included in the enumeration (Ownerid, RegardingId, subject, etc.).

Once you have the data you want to enumerate through, it is as simple as creating the entity followed by updating the Status to “Pending Sent.” Once the Status is pending in the SMS Message entity, a plugin will kick off that will send all of the necessary data to you SMS provider. An example of code is below:

EntityCollection coll = m.getList(criteria, OrganizationalServices);
        foreach (Entity e in coll.Entities)
            Entity SMS = new Entity();
            SMS.LogicalName = "posms_smsmessage";
            string message = “Please submit your timecard by midnight”;
            SMS.Attributes.Add("subject", message);
            Guid SMSID = OS.Create(SMS);
            Console.WriteLine("Created: {0}, {1}",SMS.LogicalName, SMSID.ToString());
            SetStateRequest request = new SetStateRequest()
                EntityMoniker = new EntityReference("posms_smsmessage",SMSID),
                State = new OptionSetValue(1),//1 = Closed
                Status = new OptionSetValue(730000002)//730000002 = Pending Sent

And there you have it! Now you know how to send SMS messages with PowerSMS using Dynamics 365’s SDK. Want to give PowerSMS a try? Head over to our website to download your full, FREE, 30 day trial of PowerSMS and more!

Happy Dynamics 365’ing!

Avatar for Joe D365

Joe D365

Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.