• Christad
  • NEWBIE
  • 10 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies
Hi 

I have a use case scenario to expose a custom Apex web service so that it is consumed only over https by an on-premise IIS webserver. I believe the steps to allow this are as follows but I am not sure whether webservices consumed are delivered over http or https and whether I need to do anything extra to tie it down to https. Can someone please advise. Thanks in advance.

1) Generate the enterprise wsdl to allow the external web app to log in and authenticate and obtain a session id ie Develop -> API > Generate Enterprise WSDL
2) Create the custom apex code and esure you check user access eg puesdo code:
     
      global class mySecureWebService {
          webService static Case[] getMyData(String key) {
              // Invoking a custom webService method always uses system context. Therefore write some code to use DescribeSObjectResult Class 
              // and DescribeFieldResult Class to check current user’s access level on the objects and fields that the webService method is accessing. 
              if (i!sValidAccess()) {
                   return null;
              }

              myObject[]  m = [SELECT Id, someotherdata FROM myObject  WHERE Name = :key];
              return m;
          }
      }

3) Generate the custom apex wsdl ie click Develop | Apex Classes > mySecureWebService class  > Click Generate WSDL.

4) Once the WSDL documents have been imported by the .Net application, is the webservice called over https or http? I would like to ensure that the data is transmitted securely and therefore only allow https calls but I am not sure whether I need to do anything else ?  I dont know whether I need to use the Crypto class in the webservice method or generate a certificate to provide to the IIS webserver app or configure Salesforce somewhere to expose the webservice only over https?

Thanks in advance

Adam

Hi

 

I am not sure when records are released following a SELECT FOR UPDATE lock in APEX and whether it locks the parent and child records. The link http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_locking_statements.htm suggests that a select for update operation releases the record at the end of the transaction and not after a DML operation for that sobject. The link http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_deadlocks.htm suggests that it locks the parent and its child records

 

1) Are the record released at the end of the transaction as in the example below or at the end of the first DML operation on that object ?

2) If the example class below is part of a chain of transactions, eg a trigger calls  s.doSomething() will the record be released at the end of the trigger script or immediately after the doSomething() method completes?

3) If the parent and its child records are locked, can other threads insert new child records ?

 

SomeClass s = new SomeClass();

s.doSomething();

 

public with sharing SomeClass {

     public Boolean doSomething(String x) {

                Case c = [Select CaseNumber, Status from Case limit 1 for update];    // Locks parent and child records

                c.status = ‘Closed’;

                update c;                        // DML Operation completes but does not yet release record lock

              

CaseComment cmt = new CaseComment( ParentId = c.id, IsPublished = false, CommentBody = ' some text \n');                 insert cmt;

 

      }         // DML record lock now released at end of transaction

}

 

Thanks

I am developing a custom VF page and added an edit and delete button using the <apex:commandButton action="{!edit}"/>  syntax (see code sample below). For some reason I am not able to view the buttons with this syntex even though I am a system administrator and have also checked that I have the correct privileges to view the buttons.

 

However when I use the urlfor syntax, the edit and delete buttons are displayed. I dont understand why the standard syntex do not display the buttons but using the urlfor syntax does. I have pasted a sample of the code below to demonstrate. Does anyone undestand why one works and the other doesnt ? Thanks in advance.

 

<apex:page standardController="Account" title="Sample Position Layout Page" showHeader="true" sidebar="true" >
   
    <apex:sectionHeader title="{!$ObjectType.Account.label}" subtitle="{!Account.name}"/>
      <apex:form >
      <apex:pageBlock title="Position Detail">
        <apex:pageBlockButtons >
            <apex:commandButton value="Edit" action="{!edit}"/>
            <apex:commandButton value="Edit2" action="{!URLFOR($Action.Account.Edit,Account.Id)}"/>
            <apex:commandButton value="Delete" action="{!delete}"/>
            <apex:commandButton value="Delete2" action="{!URLFOR($Action.Account.Delete,Account.Id)}"/>
            <apex:commandButton value="Sharing" onclick="window.top.location='{!URLFOR($Action.Account.Share,Account.Id)}'" />
        </apex:pageBlockButtons>
       
        <apex:pageBlockSection title="Information" columns="2">
            <apex:outputField value="{!Account.name}"/>
            <apex:outputField value="{!Account.ownerid}"/>                       
        </apex:pageBlockSection>

     </apex:pageBlock>
  </apex:form>
</apex:page>

Hi

 

I have enabled the Service Cloud console and added Cases, Contacts and Accounts in the console navigator drop down list box, but the customer would like to have Home, Opportunities, Reports and Dashboards automatically appear as separate primary tabs on the console as soon as you select the Service Console application. The idea is that the standard applications are accessible automatically via the primary tabs and any other apps such as Cases, Accounts etc are available via the drop down navigator.

 

I have looked at the Service Console Integration toolkit but am still unsure how to code the customer requirements. The sample code in the documentation describes how to write the visual force pages to invoke a primary tab using buttons and links but not how to invoke eg the standard Opportunities and Reports pages automatically as primary tabs upon selecting the service console.

 

I have used the following sample code to test the way to develop it but Im not sure how to invoke more than one primary tab displaying eg Reports and Opportunities, and how to call this automatically as soon as the service console is selected.

 

<apex:page standardController="Case">
    <apex:includeScript value="/support/console/22.0/integration.js"/>
        <A HREF="#" onClick="testIsInConsole();return false"> Click here to check if the page is in the Service Cloud console</A><br/><br/>
        <script type="text/javascript">
        function testIsInConsole() {
            if (sforce.console.isInConsole()) {
                alert("in console");
            } else {
                alert("not in console");
            }
        }

        function openPrimaryTab() {
            sforce.console.openPrimaryTab(null, 'http://www.google.com', true, 'Opportunities');
        }

        //The callback function that openSubtab will call once it's got the ID for its primary tab
        var callOpenSubtab=function callOpenSubtab(result) {
            sforce.console.openSubtab(result.id,'http://www.yahoo.com', true, 'yahoo');
        };
        
        function openSubtab() {
            sforce.console.getEnclosingPrimaryTabId(callOpenSubtab);
        }
        
        //Sets the title of the current tab to "SFDC"
        function setTitle() {
            sforce.console.setTabTitle('SFDC');
        }
        
        //The callback function that closeTab will call once it's got the ID for its tab
        var callCloseTab= function callCloseTab(result) {
            sforce.console.closeTab(result.id);
        }
        
        function closeTab() {
            sforce.console.getEnclosingTabId(callCloseTab);

        }
    </script>

    <A HREF="#" onClick="openPrimaryTab();return false">Open A Primary Tab</A>
    <p/><A HREF="#" onClick="openSubtab();return false">Open A Subtab</A>
    <p/><A HREF="#" onClick="setTitle();return false">Set Title to SFDC</A>
    <p/><A HREF="#" onClick="closeTab();return false">Close This Tab</A>
</apex:page>

 

Has anyone tried to do something similar ?

 

Many Thanks

 

Hi

 

I have written an inbound email handler service to process data stored in a text file attachment in the email. When I test the functionality by sending the email from my outlook client with the attached text file, the email handler reads the subject matter and body and processes the attached text document correctly.

 

However when a database application creates the email with a data attachment and sends it to the same salesforce address, the email subject matter and body is read correctly but Salesforce doesnt find any email attachments. No exceptions are being raised. The database application also sends a copy of the email to my email account so I can verify that the attachment is present and correct. When I try to forward the email copy from my outlook client to salesforce, the email handler still dosnt find any attachments. However if I compose a new email from my outlook client and paste the text file attachment from the email copy into the new message and then send that to salesforce, the email handler finds the attachment and processes it .

 

Has anyone else experienced this problem ?

 

Thanks

Hi

 

I have written an inbound email handler service to process data stored in a text file attachment in the email. When I test the functionality by sending the email from my outlook client with the attached text file, the email handler reads the subject matter and body and processes the attached text document correctly.

 

However when a database application creates the email with a data attachment and sends it to the same salesforce address, the email subject matter and body is read correctly but Salesforce doesnt find any email attachments. No exceptions are being raised. The database application also sends a copy of the email to my email account so I can verify that the attachment is present and correct. When I try to forward the email copy from my outlook client to salesforce, the email handler still dosnt find any attachments. However if I compose a new email from my outlook client and paste the text file attachment from the email copy into the new message and then send that to salesforce, the email handler finds the attachment and processes it .

 

Has anyone else experienced this problem ?

 

Thanks

Hi

 

I am not sure when records are released following a SELECT FOR UPDATE lock in APEX and whether it locks the parent and child records. The link http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_locking_statements.htm suggests that a select for update operation releases the record at the end of the transaction and not after a DML operation for that sobject. The link http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_deadlocks.htm suggests that it locks the parent and its child records

 

1) Are the record released at the end of the transaction as in the example below or at the end of the first DML operation on that object ?

2) If the example class below is part of a chain of transactions, eg a trigger calls  s.doSomething() will the record be released at the end of the trigger script or immediately after the doSomething() method completes?

3) If the parent and its child records are locked, can other threads insert new child records ?

 

SomeClass s = new SomeClass();

s.doSomething();

 

public with sharing SomeClass {

     public Boolean doSomething(String x) {

                Case c = [Select CaseNumber, Status from Case limit 1 for update];    // Locks parent and child records

                c.status = ‘Closed’;

                update c;                        // DML Operation completes but does not yet release record lock

              

CaseComment cmt = new CaseComment( ParentId = c.id, IsPublished = false, CommentBody = ' some text \n');                 insert cmt;

 

      }         // DML record lock now released at end of transaction

}

 

Thanks

I am developing a custom VF page and added an edit and delete button using the <apex:commandButton action="{!edit}"/>  syntax (see code sample below). For some reason I am not able to view the buttons with this syntex even though I am a system administrator and have also checked that I have the correct privileges to view the buttons.

 

However when I use the urlfor syntax, the edit and delete buttons are displayed. I dont understand why the standard syntex do not display the buttons but using the urlfor syntax does. I have pasted a sample of the code below to demonstrate. Does anyone undestand why one works and the other doesnt ? Thanks in advance.

 

<apex:page standardController="Account" title="Sample Position Layout Page" showHeader="true" sidebar="true" >
   
    <apex:sectionHeader title="{!$ObjectType.Account.label}" subtitle="{!Account.name}"/>
      <apex:form >
      <apex:pageBlock title="Position Detail">
        <apex:pageBlockButtons >
            <apex:commandButton value="Edit" action="{!edit}"/>
            <apex:commandButton value="Edit2" action="{!URLFOR($Action.Account.Edit,Account.Id)}"/>
            <apex:commandButton value="Delete" action="{!delete}"/>
            <apex:commandButton value="Delete2" action="{!URLFOR($Action.Account.Delete,Account.Id)}"/>
            <apex:commandButton value="Sharing" onclick="window.top.location='{!URLFOR($Action.Account.Share,Account.Id)}'" />
        </apex:pageBlockButtons>
       
        <apex:pageBlockSection title="Information" columns="2">
            <apex:outputField value="{!Account.name}"/>
            <apex:outputField value="{!Account.ownerid}"/>                       
        </apex:pageBlockSection>

     </apex:pageBlock>
  </apex:form>
</apex:page>