• Rakesh Kumarr
  • NEWBIE
  • 5 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 1
    Questions
  • 9
    Replies
Can we open a HTML Email template as pdf using Custom link/button, so user can print/save the document.
Hello,

I am looking for a tutorial to integrate a wed service using rest method.

I have webservice which sends XML request and get XML response.
I am looking for tutorial to integrate a simple exsisitng web service, later i will modify for me.

thanks
  • October 13, 2015
  • Like
  • 1
how to change/delete profile in sfdc
 

Hi,

 

I want to use jquery to invoke the Apex class. These jquery are written in a HTML page not visualforce page.

 

I have written some JavaScript codes to get the access_token base on OAuth2.0, so when user allow my application access their data, I want to invoke my Apex class in Force.com.

 

The following is my apex class which used the REST architecture.

 

@RestResource(urlMapping='/myservice/*')
global with sharing class MyRestResource{
 
    @HttpGet
    global static list<sObject> getRecord(RestRequest req, RestResponse res)
    {
        String objectType = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        String queryString = 'select name, id from ' + objectType;
        
        List<sObject> objects = Database.query(queryString);
        return objects;
    }
}

 

It will listen the request url which contain /myservice/*

 

Then I use cUrl tools to test this class. By the following command the apex can intercept my request url and return the right result.

 

curl -X GET https: //ap1.salesforce.com/services/apexrest/myservice/Account/ -H "Authorization: OAuth access_token" -H "X-PrettyPrint:1"


So I think I can use this url (https://ap1.salesforce.com/services/apexrest) and packaged the other parts in a jquery.ajax url to achieve the same thing.

But when I did it in a jquery.ajax method I found the ajax can't sent the request by this url pattern.

Code section:

 

$.ajax({
    type:"GET",
    url:"https://ap1.salesforce.com/services/apexrest/myservice/Account",   
    error: function(){alert("error");},
    success: function(){
            alert("Hello");
    },
    beforeSend: function(jqXHR) {
          jqXHR.setRequestHeader("Authorization", "OAuth " + oauthResponse.access_token);
    }
});

But this request can't sent successful by ajax method.

So I think the request url which sent by curl maybe analysis to another pattern in Force.com.

  

Does anyone have experiences in this field which use jquery invoke apex in a HTML page?

 

Thanks!

Hello. I'm trying Single Sign-On for Force.com with OpenAM.


1st, I tried SSO with OpenAM for normal user account. It succeeded.

I was looking at http://wiki.developerforce.com/index.php/Single_Sign-On_with_SAML_on_Force.com.


2nd, I'm trying SSO with OpenAM for Customer Portal user, now.

I don't know how to setup the following attributes on OpenAM.


https://na11.salesforce.com/help/doc/en/salesforce_winter10_release_notes.pdf - pp172.

"In the SAML assertion, add the portal_id and organization_id as attributes."

 

Note that I know the values of portal_id and organization_id.

 

Could anyone help me? Thanks.

I'm very new to this so any  help would be of great assistance!

I'm currently using the below trigger;
I'm trying to get the trigger to update the AccountOwnerID ONLY within "Contacts"  when the "Accounts" ownerID is changed.

Currently "Oppurtunities" is being changed as well, which defeats the purpose for us.

I'm not sure this is even possible, so any help would be greatly appreciated.
 

trigger Changeownertrigger on Account (after insert,after update) {
       
          Set<Id> accountIds = new Set<Id>();
          Map<Id, String> oldOwnerIds = new Map<Id, String>();
          Map<Id, String> newOwnerIds = new Map<Id, String>();
          Contact[] contactUpdates = new Contact[0];
          
          for (Account a : Trigger.new)
          {
             if (a.OwnerId != Trigger.oldMap.get(a.Id).OwnerId)
             {
                oldOwnerIds.put(a.Id, Trigger.oldMap.get(a.Id).OwnerId);
                newOwnerIds.put(a.Id, a.OwnerId);
                accountIds.add(a.Id);
             }

          }
            if (!accountIds.isEmpty()) {
             for (Account acc : [SELECT Id, (SELECT Id, OwnerId FROM Contacts) FROM Account WHERE Id in :accountIds])
                {
                String newOwnerId = newOwnerIds.get(act.Id);
                String oldOwnerId = oldOwnerIds.get(act.Id);
                for (Contact c : acc.Contacts)
                {
                   if (c.OwnerId == oldOwnerId)
                   {
                   Contact updatedContact = new Contact(Id = c.Id, OwnerId = newOwnerId);
                   contactUpdates.add(updatedContact);
                   }
                }
                 
                }
           }
                update contactUpdates;
    }

Hello. I'm trying Single Sign-On for Force.com with OpenAM.


1st, I tried SSO with OpenAM for normal user account. It succeeded.

I was looking at http://wiki.developerforce.com/index.php/Single_Sign-On_with_SAML_on_Force.com.


2nd, I'm trying SSO with OpenAM for Customer Portal user, now.

I don't know how to setup the following attributes on OpenAM.


https://na11.salesforce.com/help/doc/en/salesforce_winter10_release_notes.pdf - pp172.

"In the SAML assertion, add the portal_id and organization_id as attributes."

 

Note that I know the values of portal_id and organization_id.

 

Could anyone help me? Thanks.

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.