• WEN JIE
  • NEWBIE
  • 164 Points
  • Member since 2011

  • Chatter
    Feed
  • 5
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 48
    Questions
  • 122
    Replies
I have method which returns  static List<SObject> . How can i retrieve retruned sobject.

 
I have below sample method

@testVisible
    private static Map<String,Object> getSampleMap(List<Object> sampleList){
        Map<String,Object> sampleMap = new Map<String,Object>();
        if(sampleList!= null && sampleList.size()>0 ){
            for(Object obj : sampleList){
                sampleMap.put(obj.field1,obj);
            }
        }
        return sampleMap ;
    }
Hi, 

I am just wanting to be able to pass the current pages Name to my visualforce page, My visualforce page has a customer controller and is displaying a datatable, I can post both if there are any amendments to the code which might be needed. 

My end goal is to have a button on an account which someone can click and download any (Custom Object) Service Bookings meeting a critea matching the Account ID so that I can create a Proforma Invoice as a PDF. 

Thanks in advance. 
Hi,

I just working on SSO between Salesforce and third party system. When I test the "SP Initiated" way, I found there is a parameter in http header which named "saml_request_id".

So does anyone kown the generate principle for this parameter? Or where can I get this "saml_request_id"?


Thank you1
Hi,

I have a problem when I developing my VF page.
I have a sobject which has a field, the type for this field is "Rich Text Area". And on my VF page, I use "<apex:inputField>". Then for some reason, I need to get value from this rich text area by js or jquery.
At before, I check the page source, then use the following code to get the content from this text area:
"var internalRequirements = document.getElementById('auditPage:auditForm:auditPageBlock:itnternalRequirements:textAreaDelegate_InternalRequirements__c_frame').contentDocument.body.innerHTML;"

But it can't work anymore now.

So does anyone have good solution for this?


Thank you!
Hi,

I have a custom visualforce page. And I have a pageBlockSection with two contents. One is a <apex:tabPanel>, another one is <apex:inputField>.
In tabPanel, I have four <apex:tab> to display a multi picklist. But the contents in each tab, I use the HTML element not the apex tag.

Then I met the following problem,
We know we can collapse the Salesforce sidebar mannually. If I use the apex tag on VF page, when I collapse or open sidebar, the apex tag can adapt the page size automatically. But if I have HTML elements, they can't do this.

Have a look with screenshot:
The "Internal Requirements" is apex tag. The contents in tab are HTML elements.

When collapse sidebar:
User-added image

When expand sidebar:
User-added image

So does anyone know how to resolve this problem?


Hi,

 

I want to get the "Salesforce.com Certified Administrator"(201) certificate. I have passed DEV 401 before. I want to know whether there have a document for this 201 exam.

 

 

I download the "SGCertifiedAdministrator.pdf" but this is only a simply introduction pdf file. Does salesforce have a detailed ducoment to help us pass the ADM 201 exam?

 

 

Thank you!

Hi, 

 

I use <apex:repeat> in my visualforce email template. And the value for this tag is a list. But actually, I just only want to get one record from this list, maybe first one or last one.

 

So, does anyone know how to achieve this?

 

Thank you!

Hi,

 

I have a compotent display some info for one sobject. And for this component I have a custom controller to select info about this object by record id. I also create an attribute for this component to get record id from template.(I test it works well)

 

Then I create a visualforce email template. I set recipientType as "User" and relatedToType as my sobject. Then invoke that component in <messaging:attachment renderas="pdf">.

 

Then I saw this error message:

Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem.
 

But when I run my code this template can be invoke and I can get the mail with that pdf attachment.(production a)
And in another production environment I run as a real user (not administrator), I saw the same error.(production b)
Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem.
 

I think maybe my component custom controll didn't get the record id from template. And I really don't know why code can run in production a but can't work in production b.
 
Thank you!!!
 

Hi,

 

So far I can get a visualforce page content as pdf by pageRef.getContentAsPdf() method.

 

Now I want to get a standard page content and send them as pdf attachment in my mail.

I use the following code:

Audit__c audit = new Audit__c();
audit.Id = auditId;
        
PageReference pageRef = new ApexPages.StandardController(audit).view();
pageRef.s  etRedirect(true);

Blob b = pageRef.getContent();

Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('attachment.pdf');
efa.setContentType('application/pdf');
efa.setBody(b);

But when I try to open this pdf file I get some error as "wasn't correctly decoded".

 

If I use pageRef.getContentAsPdf(), the code can't go through and doesn't have any error info.

 

So does anyone know how to change a standard record view page as a pdf file and send it as attachment?

 

Thank you!!!

 

 

Hi,

 

I need a custom button display on my standard page layout. When I click this button can send mail to some users.

So I create a custom button, and in the "Behavior" field, I choose "Execute JavaScript". Then I try to invoke my remote action to send maill.

 

if(confirm('Is your Distribution list updated ?')){
    alert('send');
    AuditController.saveAudit(auditData , SaveCallBack, {escape:true});
}
else{
    alert('just save');
}

function SaveCallBack(result, event){
    alert(1);
}

 

But it fail. When code go to the ture condition. There is a error tell me AuditController is not defined.

 

So does anyony know how to send mail by a custom button on the standard pagelayout?

 

Thank you!

Hi,

 

I have a custom object as "A__c". And I create a trigger when I update this object record. This trigger will send mail to some users.

 

Then I create an email visualforce template. And let my trigger invoke this template when I send mail.

But I met a problem about the template.

 

I set the recipientType as "User", and relatedToType as my custom object "A__c"

 

<messaging:emailTemplate subject="Assign Audit" recipientType="User" relatedToType="A__c">
<messaging:plainTextEmailBody >
Hello {!recipient.name}

This is {!relatedTo.Name}

</messaging:plainTextEmailBody>
</messaging:emailTemplate>

When I use "Send Test and Verify Merge Fileds",assign an user and an "A" record, I can see the corresponding value display on this mail body.

 

But if I update a record then the trigger run and invoke this template, the {!recipient.name} can get value and display, but {!relatedTo.Name} can't get any value.

 

 

So does anyone meet this problem before? Or whether I have some wrong code at this template.

 

Thank you!

Hi,

 

I have a field as a rich textarea. I use inputField display this field on my vf page. But I don't know how to get the value by js or jquery. And I foung this is an iframe generagte automatically when I check the page source.

 

Does anyone knows this?

 

Thank you!

Hi,

 

I want to know whether the MobileSDK support the offline secure storage for a hybrid app.

If not, does any one has good solution about that?

And how to control the transaction when user update or insert data to salesfore meanwhile the moble device  suddenly offline.

 

Thank you!

Hi,

 

I have a problem about visual force table tag.

I use <apex:datatable> in my visualforce page, and I set a dynamic data set for this table. But now I want to set a fixed value at the first row in this table ,then display other dynamic data.

 

Does anyone know how to achieve this?

 

Thank you!

Hi,

 

I use rest api to do the CRUD with Salesforce data.

But when I do the insert data I met a problem.

My object's Standard Field Name "Name" 's Data Type is "Auto Number".  So I set a value like my auto-number style like "A0002", then I call the endpoint. But I see the following error:

 

Fail to create record on TestPackage11__TestWen__c. Unable to create/update fields: Name. Please check the security settings of this field and verify that it is read/write for your profile or permission set.

 

Then I change this Data Type as a "Text", the create operate can work successful.

 

So does anyone know how to insert a data when the object's name fields is the auto-number type?

 

Thank you!

Hi,

 

Please have a look with my scenario:

I have an object which has 4 fields. I put these in the filed set as available. Now I want to give access to customer to move it, show it or hide it and manage it on VF page.

 

Can I achieve this by Field Sets function?

 

Thank you!

Hi,

 

I want to know how to get value about this tab on Visualforce page.

 

 

Thank you!

Hi,

 

We have a legacy application, it's a cobol application. And we want to connect Salesforce to it then we can fetch data from that legacy app and display them on Salesforce.com.

 

Does anyone has any suggestion about this?

 

Thank you!

Hi,

 

I'm looking for a test case generation tool which supports our Salesforce.

 

Does anyone can give me some suggestion about this? Or which generation tool you use on Salesforce?

 

Thank you!

Hi,

 

Does anyone know how to create a custom encrypted filed(like password)? And how does Salesforce store it and  retrieve back the details?

 

Thank you!

Hi,

 

I met a problem when I install Force.com IDE in my computer.

I run the "force.com-ide-installer-win32.exe" and my OS is Windows 7.

 

The following is error log:

 

 

!SESSION Thu Aug 09 14:07:29 CST 2012 ------------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2012-08-09 14:07:29.089
!MESSAGE Invalid splash path entry: platform\:/base/plugins/org.eclipse.platform
!SESSION 2012-08-09 14:07:28.808 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_33
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -noPulseUpdate
Command-line arguments: -os win32 -ws win32 -arch x86 -noPulseUpdate

!ENTRY org.eclipse.osgi 4 0 2012-08-09 14:08:18.401
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTException: Invalid image
at org.eclipse.swt.SWT.error(SWT.java:4083)
at org.eclipse.swt.SWT.error(SWT.java:3998)
at org.eclipse.swt.SWT.error(SWT.java:3969)
at org.eclipse.swt.internal.image.PngChunkReader.readNextChunk(PngChunkReader.java:46)
at org.eclipse.swt.internal.image.PNGFileFormat.readNextChunk(PNGFileFormat.java:89)
at org.eclipse.swt.internal.image.PNGFileFormat.loadFromByteStream(PNGFileFormat.java:75)
at org.eclipse.swt.internal.image.FileFormat.loadFromStream(FileFormat.java:48)
at org.eclipse.swt.internal.image.FileFormat.load(FileFormat.java:84)
at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:130)
at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:22)
at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:331)
at com.genuitec.pulse2.common.ui.CommonUIActivator.getImage(Unknown Source)
at com.genuitec.pulse2.client.launcher.ui.LauncherUIActivator.getImage(Unknown Source)
at com.genuitec.pulse2.client.launcher.ui.product.LauncherImageSupplier.getImage(Unknown Source)
at com.genuitec.pulse2.client.installer.ui.dialog.InstallerImageService.getImageFromBranding(Unknown Source)
at com.genuitec.pulse2.client.installer.ui.dialog.InstallerImageService.getDialogIcons(Unknown Source)
at com.genuitec.pulse2.client.installer.ui.dialog.ProgressMonitorDialog.createShell(Unknown Source)
at com.genuitec.pulse2.client.installer.ui.dialog.ProgressMonitorDialog.<init>(Unknown Source)
at com.genuitec.pulse2.client.installer.ui.application.PulseApplicationProvisioner.showDialog(Unknown Source)
at com.genuitec.pulse2.client.installer.ui.application.PulseApplicationProvisioner.showDialog(Unknown Source)
at com.genuitec.pulse2.client.launcher.ui.product.LauncherApplication.start(Unknown Source)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)

 

 

So, does anyone meet the same problem before?

Hi,

 

I want to do some research about the apex runtime, I found some info about it on website, but I can't find any info from Salesforce.com.

 

So does anyone know where have an introduction about the apex runtime and usage?

 

Thank you!

Hi,

I have a custom visualforce page. And I have a pageBlockSection with two contents. One is a <apex:tabPanel>, another one is <apex:inputField>.
In tabPanel, I have four <apex:tab> to display a multi picklist. But the contents in each tab, I use the HTML element not the apex tag.

Then I met the following problem,
We know we can collapse the Salesforce sidebar mannually. If I use the apex tag on VF page, when I collapse or open sidebar, the apex tag can adapt the page size automatically. But if I have HTML elements, they can't do this.

Have a look with screenshot:
The "Internal Requirements" is apex tag. The contents in tab are HTML elements.

When collapse sidebar:
User-added image

When expand sidebar:
User-added image

So does anyone know how to resolve this problem?


We have run into an interesting problem; we are creating a table of AccountContactRelations for the users to edit fields from the account, Contact, and Account Contact relation for mulitple accounts they are assigned. 

here is our Query:
List<AccountContactRelation> a = [SELECT id, AccountId, Account.Name, Contact.LastName, Roles FROM AccountContactRelation]

We display these to the user for them to quickly edit, but the issue comes when we need to save the records. how would we be able to save Account.Name and Contact.LastName?

We used a lot salesforce RESTful APIs in our platform. We now planning to make a china version of our product. Are there any APIs or Integration not available in China except for Google and Facebook related products?

Could you remain us will there be any differences in the general developping process?

Thanks

I have a custom object that has a Visualforce page override for View, Edit, and New. When creating new standalone versions of that object, the visualforce page works fine.

However, if I am creating that object via a lookup on another object, the standard page shows up instead! It also shows up in a modal window instead of a new window.

I feel this modal window is the issue. How do I force the new object creation from a lookup use the visualforce page instead of the default page?
I have method which returns  static List<SObject> . How can i retrieve retruned sobject.

 
Please help to resolve my error.


Line: 772, Column: 1
System.LimitException: Too many SOQL queries: 101

My method

public class ViewQAAMController {

public void queryOperation()
    {
        String weekData = '20/07/2020 - 24/07/2020';
        list<String> lstSplitDate1 = new list<String>();
        lstSplitDate1.clear();
        lstSplitDate1 = weekData.split(' - ');
        for(String s : lstSplitDate1)
        {
            System.debug('The date is '+s);
        }
        
        list<QAAM_Weekly_Planner__c> queryData = [select Week_Start_Date__c, Availability__c, ReasonAvailability__c, Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c, File_Selection__c, Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c, Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, CPD_e_Learning_Maintenance__c, Coaching__c, PD_Days__c, One_on_Ones__c, Weekly_Tracker_preparation__c, Business_Communications__c, Other__c, Other1__c, Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, Availability_Checking__c, id, Week__C from QAAM_Weekly_Planner__c where Week__C =: weekData];
        list<String> weekDataStatic = new list<String>{'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
            integer i=0;
        for(QAAM_Weekly_Planner__c q : queryData)
        {
            
    AvailabilityMap.put(weekDataStatic[i], q.Availability__c);
     //Availabity Map
    CommentsMap.put(weekDataStatic[i], q.ReasonAvailability__c);
     WorkHoursMap.put(weekDataStatic[i], q.Work_Hours__c);
    //Core Categories Map
     EmpMap.put(weekDataStatic[i], q.Pre_Vet_Reviews__c);
     BAUFileReviewsMap.put(weekDataStatic[i], q.BAU_File_Reviews__c);
     DebriefsMap.put(weekDataStatic[i], q.Debriefs__c);
     FileSelectionMap.put(weekDataStatic[i], q.File_Selection__c);
     OtherworkMap.put(weekDataStatic[i], q.Other_work__c);
     OtherworkEstimation.put(weekDataStatic[i], q.Other_work_Estimate__c);
        TotalWorkTime.put(weekDataStatic[i], q.Total_Work_Time__c);
    //Shrinkage Categories Map
     TeamMeetingMap.put(weekDataStatic[i], q.Team_Meeting__c);
     HuddleMap.put(weekDataStatic[i], q.Huddle__c);
     QuarterlyUpdatesMap.put(weekDataStatic[i], q.Quarterly_Updates__c);
     GovernanceForumsMap.put(weekDataStatic[i], q.Governance_Forums__c);
     PerformanceReviewsMap.put(weekDataStatic[i], q.Performance_Reviews__c);
     TeaBreaksMap.put(weekDataStatic[i], q.Tea_Breaks__c);
     LearningMaintenanceMap.put(weekDataStatic[i], q.CPD_e_Learning_Maintenance__c);
     CoachingMap.put(weekDataStatic[i], q.Coaching__c);
     PDDaysMap.put(weekDataStatic[i], q.PD_Days__c);
     OneonOnesMap.put(weekDataStatic[i], q.One_on_Ones__c);
     WeeklyTrackerpreparationMap.put(weekDataStatic[i], q.Weekly_Tracker_preparation__c);
     BusinessCommunicationsMap.put(weekDataStatic[i], q.Business_Communications__c);
     OtherMap.put(weekDataStatic[i], q.Other__c);
     Other1Map.put(weekDataStatic[i], q.Other1__c);
     Other2Map.put(weekDataStatic[i], q.Other2__c);
     ProjecttimeMap.put(weekDataStatic[i], q.Project_Time__c);
     OthertimeMap.put(weekDataStatic[i], q.Other_Time__c);
    ProjecttimeDesMap.put(weekDataStatic[i], q.Project_Time_Description__c);
    OthertimeDesMap.put(weekDataStatic[i], q.Other_Time_Description__c);
    ShrinkageTimeMonMap.put(weekDataStatic[i], q.Shrinkage_time__c);
    //Available Hours
    AvailMonMap.put(weekDataStatic[i], q.Available_Time__c);
    CheckMonMap.put(weekDataStatic[i], q.Availability_Checking__c);
            i++;
        }
    }

 public void EmpMapSecValues()
    {
        EmpMap_Monday = EmpMap.get('Monday');
        EmpMap_Tuesday = EmpMap.get('Tuesday');
        EmpMap_Wednesday = EmpMap.get('Wednesday');
        EmpMap_Thursday = EmpMap.get('Thursday');
        EmpMap_Friday = EmpMap.get('Friday');
        System.debug(EmpMap_Monday + '-' +EmpMap_Tuesday  + '-' + EmpMap_Wednesday + '-' +EmpMap_Thursday  +'-' +EmpMap_Friday);
    }

}

I call this in 

ViewQAAMController obj = new ViewQAAMController();
obj.queryOperation();
obj.EmpMapSecValues();

and I get the error Line: 772, Column: 1 System.LimitException: Too many SOQL queries: 101

Line 772 is: integer i=0;

Regards
Karthic Sankar V P
Hi all,

I'm new to apex triggers and had posted in the community to get a trigger to create a field that summarizes Opportunities Product Families.  I was so excited when a wondeful community member was able to help. The code works create in my sandbox.  I attempted to do a change set to move into production but have been unable.  I submitted a case to Salesforce support and they recommded to post this forum since we are not on a Premier Sucess plan.

Code:
trigger populateProductFamily  on OpportunityLineItem (after Insert,before delete) {


if((trigger.IsAfter  && trigger.IsInsert)  || (trigger.IsBefore  && trigger.IsDelete)  )      // run after insert and before delete


{
//map to hold product family for a gven oppty
Map<id,Set<String>> oppprodFamilyMap = new Map<id,Set<String>>();
//get all oppty id
List<id> oppId =  new List<Id>();
List<opportunitylineitem> triggerList = new List<opportunitylineitem>();
if(trigger.IsDelete)
{  system.debug('in delete');
triggerList = trigger.old;
}

else
{
triggerList = trigger.new;
}


for (opportunitylineitem ol : triggerList )  {

   oppId.add(ol.opportunityid);

}

// query all opportunity for opportunitylineitem inserted



List<opportunity> oppList = [select id ,Opportunity_Product_Family__c from opportunity where id in :oppId];




// query all opportunitylineitem linked with opportunity of current opportunitylineitem
//we need this so that we can get all product family for a a given oppty

List<opportunitylineitem> olList  =  new List<opportunitylineitem>();

if(trigger.IsDelete) {
olList = [select id,opportunityid,product2.family  from opportunitylineitem where opportunityid in :oppList  and id not in  :triggerList  ];

}

else

{
olList = [select id,opportunityid,product2.family  from opportunitylineitem where opportunityid in :oppList  ];

}

system.debug('---ollist' + olList  );


//now we need to separate productfamily by opportunity


for (opportunitylineitem ol : olList )  {

IF(ol.product2.family  != null)  {
if(oppprodFamilyMap.get(ol.opportunityid) != null)  {

Set<String>  pFamilySet   = oppprodFamilyMap.get(ol.opportunityid);
pFamilySet.add(ol.product2.family);
oppprodFamilyMap.put(ol.opportunityid,pFamilySet);

}

else {
 Set<String> pFamilySet = new Set<String> ();
 pFamilySet.add(ol.product2.family);
oppprodFamilyMap.put(ol.opportunityid,pFamilySet);


}

}



}



// now we have got all productfamily for a given oppty.
//we need to concat  and update field


  //opplist to update
  
  List<opportunity> oppListToUpdate = new List<opportunity>();


for(opportunity  o : oppList)  



List<String>  pFamilyList = new List<String>(oppprodFamilyMap.get(o.Id));
String pFamily  = string.join(pFamilyList ,',');

o.Opportunity_Product_Family__c  = pFamily;
oppListToUpdate.add(o);

 


}


if(oppListToUpdate.size()>0)

update  oppListToUpdate;







}      

}

Error - Code Coverage Failure
Your code coverage is 0%. You need at least 75% coverage to complete this deployment.
populateProductFamily

I'm sure I have to change the sandbox, then the change set and try to deploy again into but everything I've tried fails.  Any help would be greatly appreciated.  
Hi Everyone,

if anyone find error in my apex class and please guide me.Actually i was new to write a programs.thanks you very much for helping me.

Apex class:

@RestResource(urlMapping='/DeleteInfo/*')
global class DeleteInfo {
@HttpPost
    global static String doPost() {
        String responseJSON;
        if (RestContext.request.requestBody != null) {
            String requestStatus;
            String reqBody = RestContext.request.requestBody.toString();
            String ParentId = null;
            Request Request = new Request();
            String environmentCode = Utility.getEnvironmentCode(UserInfo.getUserName());
            
            try {
                Req req = (Req)JSON.deserialize(reqBody, DeleteInfo.Req.class);
                Request = req.Request;
                
                if (Request.Parent != null) {
                    if (Request.Parent.StarID != null && Request.Parent.StarID != '') {
                        String ParentStarID = Request.Parent.StarID + '__' + environmentCode;
                        List<Hub_Parent__c> ptList = [select Id from Hub_Parent__c where StarID__c = :ParentStarID Limit 1];
                        
                        if (ptList.size() > 0) {
                            Hub_Parent__c objParent = ptList[0];
                            ParentId = objParent.Id;
                            
                            ParentDataDelete.DataDelete(objParent.Id);
                            
                            //List<ParentPrescription__c> lstParentPrescription = [select Id, Status__c from ParentPrescription__c Where Parents__c = :ParentId order by RxExpirationDate__c desc NULLS LAST, LastModifiedDate Desc limit 1];
                            
                            /*if (objParent.Prescriptions__r.size() > 0) {
                                ParentPrescription__c objParentPrescription = objParent.Prescriptions__r[0];
                                if (Request.Prescription.Status != null && (Request.Prescription.Status == 1 || Request.Prescription.Status == 2)) {
                                    String prescriptionStatus = Request.Prescription.Status == 1 ? 'Active' : 'Inactive';
                                    if (prescriptionStatus != objParentPrescription.Status__c) {
                                        objParentPrescription.Status__c = prescriptionStatus;
                                        update objParentPrescription;
                                    }
                                    responseJSON = InboundTransactionResponse.GetSucessResponse(Request.Header.TransactionType, Request.Header.TimeStamp, Request.Header.FileID, Request.Prescription.StarID);
                                    requestStatus = 'Success';
                                }
                                else {
                                    responseJSON = InboundTransactionResponse.GetErrorResponse(Request.Header.TransactionType, Request.Header.TimeStamp, Request.Header.FileID, Request.Prescription.StarID, 'Status', '0056', 'Invalid Prescription Status');
                                    requestStatus = 'Failure';
                                }
                            }
                            else {
                                responseJSON = InboundTransactionResponse.GetErrorResponse(Request.Header.TransactionType, Request.Header.TimeStamp, Request.Header.FileID, Request.Prescription.StarID, 'Prescription', '0056', 'Prescription doesn\'t exists in system for the Parent');
                                requestStatus = 'Failure';
                            }*/
                            responseJSON = InboundTransactionResponse.GetSucessResponse(Request.Header.TransactionType, Request.Header.TimeStamp, Request.Header.FileID, Request.Parent.StarID);
                            requestStatus = 'Success';
                        }
                        else {
                            responseJSON = InboundTransactionResponse.GetErrorResponse(Request.Header.TransactionType, Request.Header.TimeStamp, Request.Header.FileID, Request.Parent.StarID, 'StarID', '0056', 'StarID doesn\'t exists in system');
                            requestStatus = 'Failure';
                        }
                    }
                    else {
                        responseJSON = InboundTransactionResponse.GetErrorResponse(Request.Header.TransactionType, Request.Header.TimeStamp, Request.Header.FileID, null, 'StarID', '001', 'StarID is a required field.');
                        requestStatus = 'Failure';
                    }
                }
                else {
                    responseJSON = InboundTransactionResponse.GetErrorResponse(Request.Header.TransactionType, Request.Header.TimeStamp, Request.Header.FileID, null, 'Parent', '001', 'Invalid request format.');
                    requestStatus = 'Failure';
                }
                BlueStarTransactionDetails.CreateInboundTransactionRequest(Request.Header.TransactionType, Request.Header.FileID, requestStatus, reqBody, responseJSON, null, null, null, environmentCode);
            }
            catch (Exception ex) {
                System.debug('Delete Exception: ' + ex.getMessage());
                String fileId;
                if (Request.Header != null && Request.Header.FileID != null) {
                    fileId = Request.Header.FileID;
                }
                else {
                    fileId = 'Unknown';
                }
                BlueStarTransactionDetails.CreateInboundTransactionRequest(Request.Header.TransactionType, fileId, 'Exception', reqBody, ex.getMessage(), null, null, null, environmentCode);
                if(Request != null && Request.Header != null){
                    responseJSON = InboundTransactionResponse.GetErrorResponse(Request.Header.TransactionType, Request.Header.TimeStamp, Request.Header.FileID, null, 'Error', '0056', ex.getMessage());
                }else{
                    responseJSON = ex.getMessage();
                }
            }
        }
        return responseJSON;
    }
    
    public class Parent {
        public String StarID {get;set;}
    }
    
    public class Header {
        public String TransactionType {get;set;}
        public String TimeStamp {get;set;}
        public String FileID {get;set;}
    }
    
    public class Request {
        public Parent Parent {get;set;}
        public Header Header {get;set;}
    }
    
    public class Req {
        public Request Request {get;set;}
    }
}


Test Class for above Apex class:

@isTest
public class DeleteInfo_Test {
    static testMethod void TestDeleteInfo(){
        
        Test.startTest();
        HubTestController.createCustomSettings();
        //User usr = [Select Id from User where UserName = 'bluestar@welldocinc.com.sfdev4' Limit 1];
        List<User> usr = [Select Id,UserName from User where Name = 'bluestar bluestar' Limit 1];
        system.runAs(usr[0]){
            HubTestController.createEnviornmentSettingsWithUserName(usr[0].UserName);
            Hub_parent__c parent = new Hub_parent__c();
            parent.GivenName__c = 'Mangesh';
            parent.SampleCode__c = 'SCA1556329';
            parent.FamilyName__c = 'K';
            parent.Status__c = 'SRF Incomplete';
            parent.StarID__c ='StarID__bst';
            parent.FamilyName__c = 'K';
            parent.DOB__c = System.today();
            parent.Gender__c = 'M';
            
            insert parent;  
            RestRequest req = new RestRequest();
            RestResponse res = new RestResponse();
            
            String str ='{"Request":{"Header":{"TransactionType":"DeleteInfo","TimeStamp":"03-15-2016 12:09:15:252","FileID":"DeleteInfo.03152016120915252"},"parent":{"StarID":"StarID","Status":"Pending"}}}';
            req.requestURI = '/DeleteInfo/*';  
            req.httpMethod = 'Post';
            RestContext.request = req;
            RestContext.request.requestBody = Blob.valueOf(str);
            RestContext.response = res;
            String results = DeleteInfo.doPost();
            
            str = '{"Request":{"Header":{"TransactionType":"DeleteInfo","TimeStamp":"03-15-2016 12:09:15:252","FileID":"DeleteInfo.03152016120915252"},"parent":{"StarID":"StarID","AccountCode":"WD","SampleCode":"SampleCode"}}}';
            req.requestURI = '/DeleteInfo/*';  
            req.httpMethod = 'Post';
            RestContext.request = req;
            RestContext.request.requestBody = Blob.valueOf(str);
            RestContext.response = res;
            DeleteInfo.doPost();
            
            str = '{"Request":{"Header":{"TransactionType":"DeleteInfo","TimeStamp":"03-15-2016 12:09:15:252","FileID":"DeleteInfo.03152016120915252"},"parent":{"StarID":"StarID","AccountCode":"WD","SampleCode":"SampleCode"}}}';
            req.requestURI = '/DeleteInfo/*';  
            req.httpMethod = 'Post';
            RestContext.request = req;
            RestContext.request.requestBody = Blob.valueOf(str);
            RestContext.response = res;
            DeleteInfo.doPost();
            
            Str = '{"Request":{"Header":{"TransactionType":"DeleteInfo","TimeStamp":"03-15-2016 12:09:15:252","FileID"!=""},"parent":{"StarID"!="","AccountCode"!="","SampleCode"!=""}}}';
            req.requestURI = '/DeleteInfo/*';  
            req.httpMethod = 'Post';
            RestContext.request = req;
            req.requestBody = Blob.valueOf(str);
            RestContext.response = res;
            DeleteInfo.doPost();

            Test.stopTest();
        }
    }
}


Here i was facing issue was code was almost covered but while run the test class i was showing error.

"System.NullPointerException: Attempt to de-reference a null object".


if anyone please help me.


Thanks INadvance,
RajuBalaji