Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Thursday, June 5, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: SData How to set AssignedToId in a Ticket?
Sebastian Walter
Posts: 28
 
SData How to set AssignedToId in a Ticket?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Apr 14 3:41 AM


This SData is driving me crazy!!


We're creating a project portal. The single steps sould be synced to SalesLogix as tickets because interacting with the customers.


I've wrote some .Net code to create new tickets. I've got a Payload in there to set the single values:


ticketPayload.Values["Account"= _sDataTools.GetEntityPayload("accounts", ticketToCreate.AccountId);
ticketPayload.Values["Contact"= _sDataTools.GetEntityPayload("contacts", ticketToCreate.ContactId);
ticketPayload.Values["UrgencyCode"= (int) ticketToCreate.UrgencyCode; //ENUM
ticketPayload.Values["UrgencyId"= _sDataTools.GetTicketUrgencyId(ticketToCreate.UrgencyCode.ToString());
ticketPayload.Values["ReceiveDate"= ticketToCreate.ReceivedDate;
ticketPayload.Values["PublicAccessCode"= ticketToCreate.PublicAccessCode;
ticketPayload.Values["StatusCode"= ticketToCreate.StatusCode;
ticketPayload.Values["Subject"= ticketToCreate.Subject;

 This is working fine.

Now the problems:
I have to set the SeccodeId (Owner) to a ID "A" for example.
We need AssignetToId and ReceivedById which are getting assinged through code in that new portal.


As this seems not be possible to do this in the Create step, I've desided to do an update to this ticket:


internal void SetSeccodes(string ticketId, Ticket ticketToCreate)
        {
            var sDataSingleResourceRequest = new SDataSingleResourceRequest(_dynamicInstance)
            {
                ResourceKind = "tickets"
            };

            var sDataResourceCollectionRequest = new SDataResourceCollectionRequest(_dynamicInstance)
            {
                ResourceKind = "tickets",
                StartIndex = 1,
                Count = 1
            };
            sDataResourceCollectionRequest.QueryValues.Add("where"string.Format("Id eq '{0}'", ticketId));

            var atomFeed = sDataResourceCollectionRequest.Read();

            var receivedBy = _sDataTools.GetEntityPayload("owners", ticketToCreate.ReceivedByUserId);
            var assignedTo = _sDataTools.GetEntityPayload("owners", ticketToCreate.AssignedToUserId);
            var owner = _sDataTools.GetEntityPayload("owners", ticketToCreate.OwnerId);

            foreach (var entry in atomFeed.Entries)
            {
                var sDataPayload = entry.GetSDataPayload();
                sDataSingleResourceRequest.Entry = entry;
                sDataSingleResourceRequest.ResourceSelector = string.Format("'{0}'", ticketId);

                sDataPayload.Values["ReceivedBy"= receivedBy;
                sDataPayload.Values["AssignedTo"= assignedTo;
                sDataPayload.Values["Owner"= owner;

                sDataSingleResourceRequest.Update();
            }
        }

Doing this, my Owner is set to the Id which is provieded in the payload "assignedTo".
ReceivedBy and AssignedTo are set to the SeccodeId of the User which is logged on to SData.


Where is the problem in here??



[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: SData How to set AssignedToId in a Ticket?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Apr 14 2:11 AM

You can do it all in one step. Properties like assignedTo are complex properties. Basically they are nested payloads inside the payload.


Here's a post that will cover some about nested payloads (from a read perspective but concept is the same as setting a nested payload): http://customerfx.com/pages/crmdeveloper/2011/12/01/including-nested-payloads-with-sdata-for-saleslogix.aspx


You could do it all inline with something like this:


ticketPayload.Values["AssignedTo"] =
new SDataPayload {
Values = {
{ "OwnerId", "SECCODE VALUE" }
}
};

Hope this helps.

[Reply][Quote]
Sebastian Walter
Posts: 28
 
Re: SData How to set AssignedToId in a Ticket?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Apr 14 1:07 AM

Thank you Ryan! I'll try this later. But I'm wondering 'bout that should work, becaus I'm already creating a Owner-Payload in this "GetEntityPayload" Method.


 


...feedback later

[Reply][Quote]
Sebastian Walter
Posts: 28
 
Re: SData How to set AssignedToId in a Ticket?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Apr 14 2:25 AM

...as I've feared:


 


It does'nt work directly inserting or updating => same problem. New Seccodes are getting generated and assigned to SeccodeId and AssignedToId.

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: SData How to set AssignedToId in a Ticket?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Apr 14 10:36 AM

Sebastian,


I'm not sure what you mean by "Seccodes are getting generated and assigned to SeccodeId and AssignedToId". The system doesn't (or shouldn't be) creating new seccodeid values like that.


As for setting the Seccode and AssignedTo in the same payload as your create, that does work, however we'd likely need to see more of your code to determine why it isn't for you.

[Reply][Quote]
Sebastian Walter
Posts: 28
 
Re: SData How to set AssignedToId in a Ticket?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Apr 14 2:39 AM

Hi Ryan,

you're right! It sounds crazy, because I'm also not understanding, WHY SalesLogix is generating new SeccodeIds, but it does!!!

Back to the PayLoads: I of course tried to set the Seccode and AssignedTo in the create-PayLoad, but this also does not work.


 


This is my Code: (ticketToCreate / Ticket is a class that returns the Values the properties should be filled with)


public SlxTicket ForTicket(Ticket ticketToCreate)
{
    _dynamicInstance = _sDataSettings.SDataServiceDynamicInstance;

    var templateResourceRequest = new SDataTemplateResourceRequest(_dynamicInstance) {ResourceKind = "tickets"};

    var entry = templateResourceRequest.Read();
    var ticketPayload = entry.GetSDataPayload();

    _sDataTools = new SDataTools {DynamicInstance = _dynamicInstance};

    var owner = new SDataPayload
    {
        Values =
        {
            {"OwnerId", ticketToCreate.OwnerId}
        }
    };
    var assignedTo = new SDataPayload
    {
        Values =
        {
            {"OwnerId", ticketToCreate.AssignedToId}
        }
    };

    ticketPayload.Values["Account"= _sDataTools.GetEntityPayload("accounts", ticketToCreate.AccountId);
    ticketPayload.Values["Contact"= _sDataTools.GetEntityPayload("contacts", ticketToCreate.ContactId);
    ticketPayload.Values["AssignedTo"= assignedTo;
    ticketPayload.Values["Owner"= owner;

    ticketPayload.Values["UrgencyCode"= (int) ticketToCreate.UrgencyCode; //ENUM
    ticketPayload.Values["UrgencyId"= _sDataTools.GetTicketUrgencyId(ticketToCreate.UrgencyCode.ToString());
    ticketPayload.Values["ReceiveDate"= ticketToCreate.ReceivedDate;
    ticketPayload.Values["PublicAccessCode"= ticketToCreate.PublicAccessCode;
    ticketPayload.Values["StatusCode"= ticketToCreate.StatusCode;
    ticketPayload.Values["Subject"= ticketToCreate.Subject;

    var sDataSingleResourceRequest = new SDataSingleResourceRequest(_dynamicInstance)
    {
        ResourceKind = "tickets",
        Entry = entry
    };

    var result = sDataSingleResourceRequest.Create();
    var responsePayload = result.GetSDataPayload();

    var ticketId = responsePayload.Key;
    var ticketNumber = "";

    if (result.GetSDataHttpStatus() == HttpStatusCode.Created)
    {
        ticketNumber = _sDataTools.GetTicketNumber(ticketId);
        WriteTicketProblem(ticketId, ticketToCreate.Notes);
    }

    var slxTicketValues = new SlxTicket
    {
        TicketLink = string.Format("slx:TICKET/{0}", ticketId),
        TicketNumber = ticketNumber
    };

    return slxTicketValues;
}

 

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/5/2025 2:48:59 AM