• sravan36
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 6
    Replies

Hi All

We have a requirement like sending email notification to the case contact while creating case in salesforce. For this we have created a workflow email alert on case creation. Its working fine but we need to track email details in salesforce under cases. Is it possible to track email details?

Thanks in Advance!!!
Sravan

Hi All,

I am trying to write test class for my REST API (POST method) class, i didn't get any errors but i.e showing 0% code coverage. Below are my class and test class.

API class:

@RestResource(urlMapping='/FieldCase/*')
global Class AddComment{
   @HttpPOST
   global static string addComment(){
       String statuscode = '1';
       String datetimevalue;
       String  JSONString;
       //Map for returning output Response
       Map<String, String> returnMap = new Map<String, String>();
             RestRequest req = RestContext.request;
             RestResponse res = RestContext.Response;
             Blob body = req.requestBody;
             String bodyString = body.toString();
              Wrapclass deserializedinput = (Wrapclass)JSON.deserialize(bodyString, Wrapclass.class);
             Case parentCase = [ Select ID, CaseNumber from Case where CaseNumber =: deserializedinput.Casenum];
             CaseComment Commentobject = new CaseComment();
             Commentobject.ParentId = parentCase.Id;
             Commentobject.CommentBody = deserializedinput.Description;
             insert Commentobject;
            CaseComment CreatedComment = [Select a.LastModifiedById,LastModifiedDate From CaseComment a where id =:Commentobject.Id];
             Datetime dttime =CreatedComment.LastModifiedDate;
             datetimevalue = string.valueOf(dttime);
                statuscode = '0';
                 returnMap.put('CreatedDatetime', datetimevalue);
                 JSONString = JSON.serialize(returnMap);
                 System.debug('+++Output details+++'+JSONString);
                 return JSONString  ;
    }
    public class Wrapclass{
      public string Casenum;
      public string Description;
   }

}

Test class:

@isTest(seeallData=true)
Public class AddCommenttest{
    public static void AddCommenttest(){
       
        Case cs = new Case(status = 'open');
        insert cs;
        Case csnum = [select casenumber from Case where Id =: cs.Id];
        AddComment.Wrapclass reqst=new AddComment.Wrapclass();
        reqst.Casenum= csnum.casenumber;
        reqst.Description ='Test comment';
        String JsonMsg=JSON.serialize(reqst);

        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();

        req.requestURI =    'https://ap1.salesforce.com/services/apexrest/FieldCase'; 
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
        RestContext.response= res;
        RestContext.request = req;
        String returnMap = AddComment.addComment();
       }
}


Thanks in Advance!!

Hi All,

We are trying to do Seriolize and Deseriolize for list of attachments using JSON. But we came across some issue while deseriolizing attachments list the error is like Cannot deserialize instance of base64 from START_OBJECT value . Is it possible to Deseriolize list of attachments? Is there any problem with Blob data to deseriolize?

Below is the JSON code snippet.

list<Attachment> Attchmentslist = [select name,id,Body from Attachment where ParentId =: CId];
String JSonserlz = JSON.serialize(Attchmentslist);
list<Attachment> deserializedAttchmts = (list<Attachment>)JSON.deserialize(JsonSerlz, list<Attachment>.class);

Thanks in Advance!!!

Hi All,

I am trying to retrieve Case attachments along with case records as part of my client requirement. But i am getting an error like Binary fields cannot be selected in join queries. Is there any way to get Case and related attachments within a single query . Below is my query

[SELECT Status,casenumber,(SELECT id,name,Body FROM Attachments)  FROM Case]

Note: "Body" is must in attachments.

Thanks in Advance!!
Sravan.

HI 

 

We have a requirement for Integration btw SFDC system and External system(Java).

We need to Create different API's for each process like Create Case, Update Case, add Attachment and add Notes.

 

Is thare any standard API's for Create Case, Update Case, Add Notes and Add Attachment i.e. providing by Salesforce. I think there is a way for Accounts but any possibilites for above requirement.

 

Thanks,

Sravan.

 

Hi All,

What are the limits/Disadvantages, if we use a single controller/class for multiple VF pages.

Thanks in advance.

Hi Guys,

I would like to add Notes&Attachments(From Account object related list) signature image(png) to the PDF page in customer portal, the image is not showing on the pdf file but that is showing as a file. Is this permissions issue
or some other?.

we have used image tag like 

<apex:image url="/servlet/servlet.FileDownload?file={!imageid}" 
rendered="{!image}" height="100" width="300"/>


Thanks.

Thanks.

Hi All,

 

I want to display text encrypted Fields as input text or input field on customer portal with same behavior of  text encrypted Fields, but it is showing the original values inplace of  mask(means with out XXXXXXXX) please help on this.

 

Thanks.

Hi All,

 

            What are the standard objects in sales cloud & Service cloud? is cases object is available in both are not?

 

Thanks for your help.

 

 

Hi All,

 

           For customer portal SSO is there any flag/setup in users by which it will not ask them "Change password" on first time login

 

Thanks,

Sravan

Hi all,

    I am trying to login into SFDC cutomer portal view cases page  from other platform i.e .Net. I have generated an enterprise WSDL and incorporated into .Net web application, then i wrote the following code which login and redirects me to the customer portal login page. but in this, i am getting an error as below and it is not taking me to the requested page (ViewCases).

Error: File Not Found.
Authorization Required
 

You must first log in or register before accessing this page. 
If you have forgotten your password, click Forgot Password to reset it. 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SFDCApplication.sforce;
using System.Web.Services.Protocols;
namespace SFDCApplication
{
public partial class _Default : System.Web.UI.Page
{
private SforceService newService;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lnkLink_Click(object sender, EventArgs e)
{
try
{

string userName = "*********@******";
string passWord = "**********";

newService = new SforceService();
string orgId = "**************";
string portId = "****************";
LoginScopeHeader header = new LoginScopeHeader();
header.organizationId = orgId;
header.portalId = portId;
newService.LoginScopeHeaderValue = header;
LoginResult logRes = new LoginResult();
try
{
logRes = newService.login(userName, passWord);
}
catch (SoapException ex)
{
Console.WriteLine(ex.Code);
Console.WriteLine("An unexpected error has occurred: " + ex.Message);
Console.WriteLine(ex.StackTrace);
throw new Exception();
}
if (logRes.passwordExpired)
{
Console.WriteLine("An error has occurred. Your password has expired.");
throw new Exception();
}
string oldAuthEndPointURL = newService.Url;
newService.Url = logRes.serverUrl;
newService.SessionHeaderValue = new SessionHeader();
newService.SessionHeaderValue.sessionId = logRes.sessionId;
 
if (logRes.sessionId != "" && logRes.sessionId != string.Empty)
{
string redirectURL = "https://<CompanyName>.testing.cs10.force.com/customerportal /apex/viewcases?sessionid=" + logRes.sessionId;
Response.Redirect(redirectURL);
}
}
catch (Exception ex)
{
lblErr.Text = ex.Message;
}
}
}
}


Also i am getting the same session id again and again instead of different session id's each and every time. Then i just changed my code a little bit.
Instead of redirecting i called the logout() method, which flushes the existing session and again i called the Login() method, which creates a new session id for me. Code change as below

if (logRes.sessionId != "" && logRes.sessionId != string.Empty)
{
       this.newService.logout();
       logRes = newService.login(userName, passWord);
       string redirectURL = "https://<CompanyName>.testing.cs10.force.com/customerportal /apex/viewcases?sessionid=" + logRes.sessionId;
       Response.Redirect(redirectURL);
}

- luckily it worked and i was getting a new session id each and every time. 

After this also i am getting the same error as

Error: File Not Found.
Authorization Required
 

You must first log in or register before accessing this page. 
If you have forgotten your password, click Forgot Password to reset it. 


What is wrong in this, am i missing out anything in code. Any suggestions and ideas will be appreciated.

Thanks in advance.

Hi all,

    I am trying to login into SFDC cutomer portal view cases page  from other platform i.e .Net. I have generated an enterprise WSDL and incorporated into .Net web application, then i wrote the following code which login and redirects me to the customer portal login page. but in this, i am getting an error as below and it is not taking me to the requested page (ViewCases).

Error: File Not Found.
Authorization Required
 

You must first log in or register before accessing this page. 
If you have forgotten your password, click Forgot Password to reset it. 
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SFDCApplication.sforce;
using System.Web.Services.Protocols;
namespace SFDCApplication
{
public partial class _Default : System.Web.UI.Page
{
private SforceService newService;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lnkLink_Click(object sender, EventArgs e)
{
try
{

string userName = "*********@******";
string passWord = "**********";

newService = new SforceService();
string orgId = "**************";
string portId = "****************";
LoginScopeHeader header = new LoginScopeHeader();
header.organizationId = orgId;
header.portalId = portId;
newService.LoginScopeHeaderValue = header;
LoginResult logRes = new LoginResult();
try
{
logRes = newService.login(userName, passWord);
}
catch (SoapException ex)
{
Console.WriteLine(ex.Code);
Console.WriteLine("An unexpected error has occurred: " + ex.Message);
Console.WriteLine(ex.StackTrace);
throw new Exception();
}
if (logRes.passwordExpired)
{
Console.WriteLine("An error has occurred. Your password has expired.");
throw new Exception();
}
string oldAuthEndPointURL = newService.Url;
newService.Url = logRes.serverUrl;
newService.SessionHeaderValue = new SessionHeader();
newService.SessionHeaderValue.sessionId = logRes.sessionId;
 
if (logRes.sessionId != "" && logRes.sessionId != string.Empty)
{
string redirectURL = "https://<CompanyName>.testing.cs10.force.com/customerportal /apex/viewcases?sessionid=" + logRes.sessionId;
Response.Redirect(redirectURL);
}
}
catch (Exception ex)
{
lblErr.Text = ex.Message;
}
}
}
}


Also i am getting the same session id again and again instead of different session id's each and every time. Then i just changed my code a little bit.
Instead of redirecting i called the logout() method, which flushes the existing session and again i called the Login() method, which creates a new session id for me. Code change as below

if (logRes.sessionId != "" && logRes.sessionId != string.Empty)
{
       this.newService.logout();
       logRes = newService.login(userName, passWord);
       string redirectURL = "https://<CompanyName>.testing.cs10.force.com/customerportal /apex/viewcases?sessionid=" + logRes.sessionId;
       Response.Redirect(redirectURL);
}

- luckily it worked and i was getting a new session id each and every time. 

After this also i am getting the same error as

Error: File Not Found.
Authorization Required
 

You must first log in or register before accessing this page. 
If you have forgotten your password, click Forgot Password to reset it. 


What is wrong in this, am i missing out anything in code. Any suggestions and ideas will be appreciated.

Thanks in advance.

Hi all,

    I am trying to login into SFDC cutomer portal view cases page  from other platform i.e .Net. I have generated an enterprise WSDL and incorporated into .Net web application, then i wrote the following code which login and redirects me to the customer portal login page. but in this, i am getting an error as below and it is not taking me to the requested page (ViewCases).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SFDCApplication.sforce;
using System.Web.Services.Protocols;
namespace SFDCApplication
{
public partial class _Default : System.Web.UI.Page
{
private SforceService newService;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lnkLink_Click(object sender, EventArgs e)
{
try
{

string userName = "*********@******";
string passWord = "**********";

newService = new SforceService();
string orgId = "**************";
string portId = "****************";
LoginScopeHeader header = new LoginScopeHeader();
header.organizationId = orgId;
header.portalId = portId;
newService.LoginScopeHeaderValue = header;
LoginResult logRes = new LoginResult();
try
{
logRes = newService.login(userName, passWord);
}
catch (SoapException ex)
{
Console.WriteLine(ex.Code);
Console.WriteLine("An unexpected error has occurred: " + ex.Message);
Console.WriteLine(ex.StackTrace);
throw new Exception();
}
if (logRes.passwordExpired)
{
Console.WriteLine("An error has occurred. Your password has expired.");
throw new Exception();
}
string oldAuthEndPointURL = newService.Url;
newService.Url = logRes.serverUrl;
newService.SessionHeaderValue = new SessionHeader();
newService.SessionHeaderValue.sessionId = logRes.sessionId;
 
if (logRes.sessionId != "" && logRes.sessionId != string.Empty)
{
string redirectURL = "https://<CompanyName>.testing.cs10.force.com/customerportal /apex/viewcases?sessionid=" + logRes.sessionId;
Response.Redirect(redirectURL);
}
}
catch (Exception ex)
{
lblErr.Text = ex.Message;
}
}
}
}


Also i am getting the same session id again and again instead of different session id's each and every time. Then i just changed my code a little bit.
Instead of redirecting i called the logout() method, which flushes the existing session and again i called the Login() method, which creates a new session id for me. Code change as below

if (logRes.sessionId != "" && logRes.sessionId != string.Empty)
{
       this.newService.logout();
       logRes = newService.login(userName, passWord);
       string redirectURL = "https://<CompanyName>.testing.cs10.force.com/customerportal /apex/viewcases?sessionid=" + logRes.sessionId;
       Response.Redirect(redirectURL);
}

- luckily it worked and i was getting a new session id each and every time. 

After this also i am getting the same error as

Error: File Not Found.
Authorization Required
 

You must first log in or register before accessing this page. 
If you have forgotten your password, click Forgot Password to reset it. 


What is wrong in this, am i missing out anything in code. Any suggestions and ideas will be appreciated.

Thanks in advance.

Hi All,

I am trying to retrieve Case attachments along with case records as part of my client requirement. But i am getting an error like Binary fields cannot be selected in join queries. Is there any way to get Case and related attachments within a single query . Below is my query

[SELECT Status,casenumber,(SELECT id,name,Body FROM Attachments)  FROM Case]

Note: "Body" is must in attachments.

Thanks in Advance!!
Sravan.

HI 

 

We have a requirement for Integration btw SFDC system and External system(Java).

We need to Create different API's for each process like Create Case, Update Case, add Attachment and add Notes.

 

Is thare any standard API's for Create Case, Update Case, Add Notes and Add Attachment i.e. providing by Salesforce. I think there is a way for Accounts but any possibilites for above requirement.

 

Thanks,

Sravan.

 

Hi All,

We are trying to do Seriolize and Deseriolize for list of attachments using JSON. But we came across some issue while deseriolizing attachments list the error is like Cannot deserialize instance of base64 from START_OBJECT value . Is it possible to Deseriolize list of attachments? Is there any problem with Blob data to deseriolize?

Below is the JSON code snippet.

list<Attachment> Attchmentslist = [select name,id,Body from Attachment where ParentId =: CId];
String JSonserlz = JSON.serialize(Attchmentslist);
list<Attachment> deserializedAttchmts = (list<Attachment>)JSON.deserialize(JsonSerlz, list<Attachment>.class);

Thanks in Advance!!!

Hi I am testing my triggers and getting problems to write test method for triggers as i am new to test methods. Here is my trigger. the problem that i facing is due to three different objects are used in my trigger. Please review this code for trigger that i wrote. Thanks in advance.

Trigger Code:

 

 trigger RiskConvInsert on JunctionRiskRiskSearch__c (after insert)
  {
          List<JunctionRiskSearchConvJunc__c> juncRRSCJ = new List<JunctionRiskSearchConvJunc__c>();
          for(JunctionRiskRiskSearch__c jrsc: Trigger.New)
          {
              List<Risk_Conversation__c> riskConv = [Select Id from Risk_Conversation__c where Risk_Search__c =: jrsc.Risk_Searches__c];
              for(Risk_Conversation__c riskConvRec: riskConv)
              {
                  JunctionRiskSearchConvJunc__c junRec = new JunctionRiskSearchConvJunc__c();
                  junRec.Risk_Conversations__c = riskConvRec.Id;
                  junRec.JunctionRiskSearch__c = jrsc.Id;
                  juncRRSCJ.add(junRec);
              }
              insert juncRRSCJ;
          }
      }

Hello.

 

I am writing a Visualforce controller that creates a custom object.  The controller is for a page in a Sites site.

 

The code compiles ok, but when I run it, I get the error "Field is not writeable".

 

When I go to the Sites user profile, all the fields are visible and the object has all the permissions (read/create/edit/delete/view all/modify all)

 

Any thoughts?

 

Carl

  • October 03, 2013
  • Like
  • 0

Hi All,

I am trying to retrieve Case attachments along with case records as part of my client requirement. But i am getting an error like Binary fields cannot be selected in join queries. Is there any way to get Case and related attachments within a single query . Below is my query

[SELECT Status,casenumber,(SELECT id,name,Body FROM Attachments)  FROM Case]

Note: "Body" is must in attachments.

Thanks in Advance!!
Sravan.

I seriously need to be able to create a Roll-up field on Accounts for the Assets object, but it doesn't display as an option in the "Summarize Object" drop down when I go to create the field.

 

Can anyone tell me how to get Assets as an object there?

 

Thanks!

i want to dispaly the popup for the field value when i doubleclick on that particular field value............example plz(Using javascript or Vf)

 

 

 

thanks

=============

 

VenkatSforce89