• Ankita Gupta 65
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 6
    Replies
I've created a Visualforce page and added the contentType="application/vnd.ms-excel#SalesForceExport.xls" cache="true" to page tag. This is exported successfully in laptop and desktop. But it gives error in iPad. It says file unsupported. 
How can I give the functionality to export the data to excel to the user on iPad.
Hi All,
I have a complex requirement with below details:
1. I need to create a custom survey form with configurable questions (Admin can configure(add,update,delete) the questions) for a selected Brand
2. Each time the admin adds a new question, deletes/edits an existing one then the user should be able to fill a new version of this form while the forms submitted with previous version must be retained.
Can you help me with the data model for such scenario and the logic for maintaing the version history.


 
My requirement is to show a lookup on user object filtered based on a permission set. Since filtering is not possible on the basis of permission set, I wish to achieve it by making a SOQL query in my controller. Once I get a list of users with the given permission set in my apex controller, how can I show that list as a lookup in the Visual force page. 
Hi All, I want to deploy my connected app from Dev sandbox to QA and then prod. However, I'm not getting any option to add it in the change set. Can anyone help me how can I take the connected app to different orgs.
Hi All,
Can anyone explain me with examples or share some resources where the difference between Record Types, Business Process and Page Layouts is clear. I did not get any resource related to Buiness Process and Record Type on Trailhead.
Hi, I'm trying to create 2 object records in apex. I'm having issues in bukifying the code. I have a Map<A,B> where A is master object and B is child object. Once I insert A, I need to update the field in B with record ID of A. Can anyone tell me how can this code be bulkified.
I'm getting the below error while checking the challenge for Module- Map your workflow criteria to process criteria.
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: TTQXZXCK
Hi All,
I have created an APEX REST service to insert few records in custom object and few attachments. The service works fine for multiple attachments of size ~60KB. However, when attachments of size ~2MB is sent, we get an error 'Apex heap size too large'. I have a requirement where multiple attachments of size ~3MB should be inserted using REST API. Please help.
Working on assignment where I'm getting the below error in fflib_SObjectDomain class.
Apex trigger AccountsTrigger caused an unexpected exception, contact your administrator: AccountsTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Class.fflib_SObjectDomain.triggerHandler: line 346, column 1

This line is 
Type constructableClass = domainClassName.endsWith('Constructor') ? Type.forName(domainClassName) : Type.forName(null,domainClassName+'.Constructor');
I'm a little new to exception handling. I've created a very basic scenario where I want to handle an exception in trigger.
Picklist values in field TestPicklist__c of object TestException__c: Yes, No
I'm updating this field with other value than Yes/No so that exception is throw.
trigger TestExceptionHandling on TestException__c (before insert) {
if(trigger.isBefore && trigger.isInsert)
{
    try{
    for(TestException__c testObj:trigger.New)
    {
          
        testObj.TestPicklist__c='Undecided';
        
        
    }
    }
    catch(Exception e)
        {
            System.debug('Error is here'+e.getMessage());
           
        }
}
}

But this code does not give anything in debug logs. Plus the message on page is Salesforce specific message for an error. I want to see the error in debug logs as well.
'Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger TestExceptionHandling caused an unexpected exception, contact your administrator: TestExceptionHandling: data changed by trigger for field TestPicklist: bad value for restricted picklist field: Undecided'
I have established a S2S connection between 2 sandboxes. But when clicking on Subscribe button I get the below error:
Salesforce to Salesforce communication error
There was an error communicating with this connection. The salesforce.com support team has been notified of the problem. We apologize for the inconvenience. 

Click here to return to the previous page.
I have the following scenario-
I have 2 objects with master-detail relationship. Object A-Detail and object B-Master
On the trigger on Object A(before insert), I'd like to create a B record and add it to the A record. For instance-
trigger appendChild on A(before insert)
{
for(A aRecord : trigger.new)
{
B bRecord=new B(Name='xyz');
insert bRecord;
aRecord .field=bRecord.Id;
}
}
How can I bulkify this code to avoid DML insert inside for loop?
I have 2 objects-Parent and Child object with master-detail relationship between them. The child object has standard notes and attachments in it. I have established Salesforce 2 Salesforce(S2S) between two orgs(sandboxes). I have written 2 triggers:
1. 1 trigger to forward the master object using S2S
2. 1 trigger to pass the child object. The master detail relationship is successfully maintaned in the target org.

However, I'm unable to pass the attachments of the child object. Using RelatedRecords(Attachment) on PartnerNetworkRecordConnection instance also does not help.Please suggest
I have a Visualforce page on which we have the 'Approval Process' list shown as a related list. Prior to Spring'17 release the approval process was working successfully. Now when the user clicks on 'Submit for approval' button below two errors shop up:
The page you submitted was invalid for your session. Please click Save again to confirm your change.
We need to confirm that your request is valid. Please repeat your last action.

Any help would be highly appreciated.
I am working on developing the Test Class for Maintenence Request. All my assertions have passed, however the code coverage for trigger and its handler is 0. Below is my code. Any help would be highly appreciated.
//Trigger Code
trigger MaintenanceRequest on Case (before update, after update) {
  
  //  MaintenanceRequestHelper.updateWorkOrders();
    
  List<Case> caseList=new List<Case>();
    if(Trigger.isAfter)
    {
    for(Case req:Trigger.New)
    {
        
       if(req.Status == 'Closed' && (req.Type == 'Repair' || req.Type == 'Routine Maintenance'))
       {
           caseList.add(req);
       }
    }
    }
    MaintenanceRequestHelper.updateWorkOrders(caseList);
}

//Handler Code
public class MaintenanceRequestHelper {
    
    public static void updateWorkOrders(List<Case> requestList){
        // update workorders
         List<Case> cList=new List<Case>();
        Integer days;
        Date d=System.today();
        for(Case c:requestList)
        {
            List<Decimal> maintCycleList=new List<Decimal>();
            List<Work_Part__c> wkPart=[SELECT Id,Name,Equipment__c FROM Work_Part__c WHERE Maintenance_Request__c =:c.Id];
            for(Work_Part__c wp:wkPart)
           {
           List<Product2> equipList=[SELECT Name,Maintenance_Cycle__c FROM Product2 WHERE Id=:wp.Equipment__c];
               for(Product2 p:equipList)
               {
               maintCycleList.add(p.Maintenance_Cycle__c);
                   }
           }
          if(maintCycleList.size()>0)
          {
            maintCycleList.sort();
          
         Decimal maintCycle=maintCycleList.get(0);
        
         days=Integer.valueOf(maintCycle);
          }
            else
            {
             
         days=Integer.valueOf(0);   
            }
             Case newReq=new Case(Vehicle__c=c.Vehicle__c,Equipment__c=c.Equipment__c,Type='Routine Maintenance',Subject='New Request',Date_Reported__c=System.today(),Date_Due__c=d.addDays(days));
       
       cList.add(newReq);
        
       
        }
       insert cList; 
    }        
    
}

//Test Class
@isTest
private class TestMaintenanceRequest {
      
        
//Method to test trigger not working
    @isTest static void testMet1()
    {
      List<Case> caseList=new List<Case>();
        for(Integer i=0;i<300;i++)
        {
            Case c=new Case(Subject='TestSubject '+i);
            caseList.add(c);
        }
        test.startTest();
        insert caseList;
        test.stopTest();
        List<Case> assertCase=[SELECT Id FROM Case Where Subject Like 'TestSubject%' AND Status != 'Closed'];
        System.assertEquals(300,assertCase.size());
        
    }
    //Test method to test trigger working
    
    @isTest static void testMet2()
    {
        Product2 p=new Product2(Replacement_Part__c=true,Name='TestEquip',Maintenance_Cycle__c=5);
        insert p;
        Date d=System.today();
            Integer days=Integer.valueOf(p.Maintenance_Cycle__c);
        Vehicle__c v=new Vehicle__c(Name='TestVehicle');
        insert v;
        List<Case> caseList=[SELECT Id FROM Case WHERE Subject Like 'TestSubject%' AND Status != 'Closed' LIMIT 300];
        List<Case> updateList=new List<Case>();
        List<Work_Part__c> workPartList=new List<Work_Part__c>();
        for(Case c:caseList)
        {
            c.Status='Closed';
            c.Type='Repair';
            c.Vehicle__c=v.Id;
            Work_Part__c w=new Work_Part__c(Maintenance_Request__c=c.Id,Equipment__c=p.Id);
            updateList.add(c);
            workPartList.add(w);
        }
        test.startTest();
        try{
        Database.SaveResult[] insertResult=Database.insert(workPartList);
        for(Database.SaveResult sr:insertResult)
        {
            if(sr.isSuccess())
            {
                Database.SaveResult[] updateResult=Database.update(updateList);
                for(Database.SaveResult ur:updateResult)
          if(ur.isSuccess())
        {
            
         List<Case> assertNewCase=[SELECT Id FROM Case Where Equipment__c=:p.Id AND Vehicle__c=:v.Id AND Type='Routine Maintenance' AND Subject='New Request' AND Date_Reported__c=:d AND Date_Due__c=:d.addDays(days)];
        System.assertEquals(300,assertNewCase.size());
        }
            }
        }
        }
        catch(Exception e)
        {
            
        }
         test.stopTest();
        
        
    }
}

User-added image
Working on assignment where I'm getting the below error in fflib_SObjectDomain class.
Apex trigger AccountsTrigger caused an unexpected exception, contact your administrator: AccountsTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Class.fflib_SObjectDomain.triggerHandler: line 346, column 1

This line is 
Type constructableClass = domainClassName.endsWith('Constructor') ? Type.forName(domainClassName) : Type.forName(null,domainClassName+'.Constructor');
Hi All,
I have a complex requirement with below details:
1. I need to create a custom survey form with configurable questions (Admin can configure(add,update,delete) the questions) for a selected Brand
2. Each time the admin adds a new question, deletes/edits an existing one then the user should be able to fill a new version of this form while the forms submitted with previous version must be retained.
Can you help me with the data model for such scenario and the logic for maintaing the version history.


 
Needing help to get Case information to my C# rest service.
Below is my code, but I am getting "Bad Request" error.
I am not sure what I need to do to get my query results to my service for reading.
Thanks,
KS
String Soql = 'SELECT LastModifiedDate,Plaintiff_Full_Name__c,Plaintiff_Last_Name__c FROM Case limit 3';
List<sObject> L = Database.query(Soql);
String url = 'http://server/ErpApiService/api/PriceForCustomerB/' + L;

System.Debug(url);

Http h = new Http();
HttpRequest req = new HttpRequest();
system.debug('got request');
req.setHeader('Content-Type', 'application/json');

req.setEndpoint(url);
system.debug('setendpoint');
req.setMethod('GET');
HttpResponse res = h.send(req);

 system.debug('res' + res);
system.debug('Price: ' + res.getBody());

 
Hi, I'm trying to create 2 object records in apex. I'm having issues in bukifying the code. I have a Map<A,B> where A is master object and B is child object. Once I insert A, I need to update the field in B with record ID of A. Can anyone tell me how can this code be bulkified.
Hi All,
I have created an APEX REST service to insert few records in custom object and few attachments. The service works fine for multiple attachments of size ~60KB. However, when attachments of size ~2MB is sent, we get an error 'Apex heap size too large'. I have a requirement where multiple attachments of size ~3MB should be inserted using REST API. Please help.
I'm a little new to exception handling. I've created a very basic scenario where I want to handle an exception in trigger.
Picklist values in field TestPicklist__c of object TestException__c: Yes, No
I'm updating this field with other value than Yes/No so that exception is throw.
trigger TestExceptionHandling on TestException__c (before insert) {
if(trigger.isBefore && trigger.isInsert)
{
    try{
    for(TestException__c testObj:trigger.New)
    {
          
        testObj.TestPicklist__c='Undecided';
        
        
    }
    }
    catch(Exception e)
        {
            System.debug('Error is here'+e.getMessage());
           
        }
}
}

But this code does not give anything in debug logs. Plus the message on page is Salesforce specific message for an error. I want to see the error in debug logs as well.
'Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger TestExceptionHandling caused an unexpected exception, contact your administrator: TestExceptionHandling: data changed by trigger for field TestPicklist: bad value for restricted picklist field: Undecided'
Hi -
I'm trying to follow the instructions on this page:
https://developer.salesforce.com/docs/atlas.en-us.eclipse.meta/eclipse/debugger_perm_set.htm
And I'm getting stuck on step 8 "Enable the Debug Apex permission." I don't see the permission set I created in the list, so I can't enable it. Any suggestions? Thanks.