• sheenam jagga
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi Everyone,
I'm new to rest webservices.
for the integration superbadge I developed below code under Synchronize Inbound Project Data.
@RestResource(urlMapping='/project/*')
global class ProjectRESTService {
    //Implement service logic here
    
    @HttpPost
    global static string postProjectData(String ProjectRef, String ProjectName,string OpportunityId,
        Date StartDate, Date EndDate,Double Amount ,String Status) {
        string response ;
        Project__c proj =[select Billable_Amount__c,End_Date__c,Opportunity__c , ProjectRef__c,
                            Start_Date__c , Status__c from Project__c where ProjectRef__c =:ProjectRef];
        if(proj == null )
        proj = new Project__c();
        proj.ProjectRef__c = ProjectRef ;
        proj.Name = ProjectName ;
        proj.Opportunity__c  = OpportunityId ;
        proj.Start_Date__c = StartDate;
        proj.end_Date__c = EndDate;
        proj.Billable_Amount__c = Amount ;
        proj.Status__c = status ;
        opportunity optytoUpdate = new  opportunity(Id =OpportunityId  );
        optytoUpdate.DeliveryInstallationStatus__c = 'In progress' ;
        try{
            update optytoUpdate ;
             upsert proj  ;
             response  ='Ok';
          }
          catch(Exception ex){
              response   = 'Error Occured : '+ ex.getMessage();
          
          }   
        return response   ;
    }   

}

Now wondering how to test it.
As described when opportunity is updated to closed won Stage is succesfully updated to Submitted Project. 
inbound call does not happen after that. how do i troubleshoot?

 
I have a community configured using napili template. Now my requirement is i need to redirect to the custom objects record detail page on click of the tab specified in navigation menu. Presently when I select the Community page "Mypage" in navigation menu directly it gives following error.

The URL for My Assessor Registration requires one or more parameters. Please replace each parameter with the appropriate value.

If I select the custom object in navigation menu it redirects to list view where when I click on record the detail page opens.
My requirement is directly I need to redirect to detail page of the record on click of tab specified in navigation menu.(This custom object is related to the contacts from which i have loged in as community user)
Many Thanks, Kalpesh
Hi

I am trying to implement an IdP initiated SSO with my DEV edition of Salesforce - basically login to my SF from a local web app.

I am generating the SAML2.0 using .NET from an ASP.NET MVC app and using an HTTP POST to post the saml token. 

The SAML2.0 assertion validates successfully in the Validator tool.

I have my SF org link "https://xxxxxxx-dev-ed.my.salesforce.com?so=00DU0000000Y2Vx" as the receipient, my dev environment "http://localhost:25364/" as the issuer, "https://saml.salesforce.com" as the Allowed Audiences, my SF user account in the SAML subject.

After the HTTP POST, the Login History shows that the IdP SSO login attempt is successful.

But, after the login the user is taken to my login page in Salesforce.  I am expecting it to take me to my SF Home page.

Following are the screenshots showing relevant info including ASP.NET MVC code on how I am doing the HTTP POST from a Controller Action method.

Greatly appreciate any pointers on what I could be missing.

Thank you

SAML 2.0 Validator Results

Single Sign On Settings

SSO Login History showing successful login attempts

SSO Login taking me to the login screen - expecting it to take me to the Home Page instead

Here is how I am doing a HTTP Post from an ASP.NET MVC Controller Action Method.
var xml = <.............SAML Response XML here ................>
            //  the RelayState parameter to control where users get redirected after a successful login
            var postData = String.Format("SAMLResponse={0}&RelayState={1}",
                        System.Web.HttpUtility.UrlEncode(
                        xml),
                        System.Web.HttpUtility.UrlEncode("https://yk-dev-ed.my.salesforce.com/home/home.jsp"));

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://yk-dev-ed.my.salesforce.com?so=00DU0000000Y2Vr");

            // set post headers
            request.Method = WebRequestMethods.Http.Post;
            //request.KeepAlive = true;
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = postData.Length;

            // write the data to the request stream         
            //StreamWriter writer = new StreamWriter(request.GetRequestStream());
            //writer.Write(postData);

            // iirc this actually triggers the post
            //HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            using (StreamWriter writer = new StreamWriter(request.GetRequestStream()))
            {
                writer.Write(postData);
            }

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
            {
                var txt = reader.ReadToEnd();
                Response.Write(txt);
            }

 
  • March 07, 2016
  • Like
  • 0