• Owen Park
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

Hello,
Is it possible to see the values that are being pulled from Salesforce for Outlook when I am "adding an email" from within the Outlook Side Panel? I am getting an empty field error but there is a value in the field.

We've got a custom object named SE_Request__c that lets people add a request for support from our sales engineering team.  A request might be something like "I need a demo of xyz, via webex, to client Foo on 2012/03/02"

 

What I'm trying to do is write a trigger on the Object to write a new Event to a shared calendar after insert.  Our SF admin has set up a shared calendar named "Ops Calendar", but I can't figure out how to get a userId from that name for use in creating a new Event object.

 

Here's what I have, with a comment showing where I'm stuck...

 

 

trigger SE_Request_Calendar_Trigger on SE_Request__c (after insert) {
	 list<event> newEvents = new list<event>();
	 
	 string salesOpsCalendar = 'Ops Calendar';

	 for (SE_Request__c seRequest : System.Trigger.new) {
	     try {
	         newEvents.add(new Event(
	             
	             //  How do I convert 'Ops Calendar' to an id that owns our shared calendar?	             
	             OwnerId = ???, 

	             ActivityDateTime = seRequest.Date_of_Requested_Demo__c,

		         DurationInMinutes = 60,

		         // Local or on-site
		         Location = seRequest.Type_of_Demo__c,

		         Subject = 'Give a demo of ' + Products_for_Demo__c + ' for ' + seRequest.Requester_Name__c
		       )
		      );
	     }
	     catch(Exception e){
	         system.debug(e);
	     }
	 } 
	 
	 insert newEvents;
}

 

 

Is it possible to add an event to a public calendar via apex or the API in general?  I could try it myself, but it's much quicker to ask.

Once I've added an event to a public calendar via the standard UI, I can pull up the record in Apex Explorer etc. and see that it's put in the public calendar ID as the OwnerID, but don't know if apex will let me write that value directly.  (I've noticed that one quirk of the standard UI is that while I can create an event in the public calendar if I start from that calendar, I can't take an existing event and move it to a public calendar by typing the name of the calendar in the Assigned To field (which I assume corresponds to OwnerID.)   I want to make sure there aren't similar limitations on edits for apex.

And is there any way to pull up a list of public calendars and their ID's?  I don't see the object anywhere in the scema explorer.

Thanks much!

  • November 14, 2007
  • Like
  • 0