function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Upsert Task Item - Remove EDIT function

Hi - I've created a web service to upsert to the TASK table.  The upsert works and the item shows up in the Activity History.  Is it possible to remove the edit link for this item?  I don't want people to be able to change it.  There is also an EDIT button when they view the task detials that I would need to remove.  Also, can you tell me how to put a value into the field labelled NAME?  Data type is Lookup(Contact,Lead).
I've include the code just in case...
Thanks you!


        public string APEXUPSERT(string SessionID,

               string TechID, string TechName, string SSOID, string TechDescr,

               string Status, string CField0, string CField1, string CField2,

               string CField3, string CField4, string CField5, string ChatLog,

               string WaitingTime, string PickupTime, string ClosingTime)


            SforceService sfdc = new SforceService();

            sfdc.Url = CField5;

            sfdc.SessionHeaderValue = new SessionHeader();

            sfdc.SessionHeaderValue.sessionId = CField1;

            sforce.Task[] task = new Task[1];

            task[0] = new sforce.Task();

            task[0].WhatId = CField3;

            task[0].IsClosed = true;

            task[0].Subject = "Rescue Session";

            task[0].Description = ChatLog;

            task[0].LastModifiedDate = DateTime.Now;

            task[0].TechID__c = TechID;

            task[0].TechName__c = TechName;

            task[0].WaitingTime__c = WaitingTime;

            task[0].PickupTime__c = PickupTime;

            task[0].ClosingTime__c = ClosingTime;

            task[0].TechDescr__c = TechDescr;

            task[0].IsClosed = true;

            task[0].Status = "Completed";

            sforce.UpsertResult ur = sfdc.upsert("Id", task)[0];


                if (ur.success)


                    return "OK";




                    return "ERROR";




You control access to records through security.  You would probably want to use organization wide defaults to restrict access to the data, and then share it with the appropriate people.  The security will be automatically reflected in the user interface.

The Name field is the record name defined for the object.  You can add a value for the field the way you would for any other field.

Hope this helps.

Thanks Rick!

But I want to restrict them from editing only certian records in TASK.  Is that possible?


I tried:   task[0].Who = Cfield0; //Cfield0 is a string

but I got the error "Cannot implicitly convert type 'string' to 'sforce.Name'

Yes - that is the point of sharing rules: to allow people to access some records.  Check out the Creating On Demand Applications book or the onl-line help for more details.

Not sure of the coercion problem on the Name field.  I'll see if I can find something.

Hope this helps.