• Ankit Maini.
  • NEWBIE
  • 98 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 32
    Replies
Hi,

I am new to Salesforce. I have look thru the list of API available in Salesforce.
I need to get the data in Account and Contact as following into my Java application:
User-added image
Any suggestion which API I should focus and start on?
  • February 06, 2015
  • Like
  • 0
Trying to deploy development from my sandbox using change sets. Whilst custom fields, tabs etc come across fine, the triggers are failing with the following error:

Code Coverage Failure Your organization's code coverage is 0%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.

This means nothing to me and I'm just getting more confused looking through the help documents. I don't really do code and I don't know where to start. Any help would be very much appreciated
I have oveveride the stadard "New"  button with a component (Parent) and in that parent component there is a child component. In the child component I have a button and on that button click I am navigating it to the record detail page( Which is actually the "View" itself.
But navigation is not working ( As init method is not callling again of the Parent component)

ParentComponent (Overide on "New" button)
<aura:component implements="lightning:isUrlAddressable,lightning:actionOverride,force:appHostable,flexipage:availableForAllPageTypes">
  
    <aura:handler name="init" value="{! this }" action="{! c.init }"/>
    
    
    <c:NavigationDemoView />
</aura:component>

Parent COntroller
({
	init : function(component, event, helper) {
        debugger;
	alert(3);
	}
})

Child Component 
<aura:component implements="lightning:isUrlAddressable,lightning:actionOverride,force:appHostable,flexipage:availableForAllPageTypes">
    <aura:handler name="init" value="{! this }" action="{! c.init }"/>
   
     <lightning:button name="s" onclick="{!c.navigateRecord}" value="click"  label="navigate to sobject"/>
   
</aura:component>
Child COntroller:
({
	init : function( component, event, helper) {
		debugger;
       alert('child called');
	},
     navigateRecord : function(component, event, helper) {
         debugger;
      	var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
          "recordId": "a040I00002W6ryNQAR"
        });
        navEvt.fire();
      }
})

If I access the view of this record (a040I00002W6ryNQAR) and click on the buttton it will not reload init of my parent.

But if access different record and click on the button it will redirect to this(a040I00002W6ryNQAR) record.

So I am not able to understand that why I am not able to redirect to the same record again.

Note: Instead of navigateToSObject, I have used other options like navigateTOURL and calling another component and calling navigatrtosobject from there but nothing is working for the same recordID for which I am viewing the record.

Please suugest.

 
I have used force:inputField on a lighting component and pre-populate the WhatID. Before summer 19, pre-populate was working fine, but it stopped working in summer19. Any woraround for this?
 
Component Code:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
 
<aura:attribute name="newTask" type="Task" default="{ 'sobjectType' : 'Task','Status':'Open', 'WhatId' : '' }" />

<div class="marginDiv forceInput">
       <div>Related To</div>
        <div><force:inputField aura:id="relatedTo" value="{!v.newTask.WhatId}"/></div>
 </div> 
</aura:component>



Controller:

({
doInit : function(component, event, helper) {
	var recId = component.get("v.recordId");
							var value = [{ 
							   type: 'My_Custom_Object__c', 
							   id: recId, 
							   label: "navigate", 
						   }]; 
						  
						  
						   if(component.find("relatedTo")){
							   component.find("relatedTo").get("v.body")[0].set("v.values", value); 
								
						   }
						   

					
	
	})
---------------------------------------------------------------------------------------------------------------

 
There is strange thing happening, I have a logic in a apex class to convert the lead(via visualforce page), When Lead is pending for approval process it gives me an error:
User-added image

This is correct because if lead is pending from approval we can not convert it.

Now if I go to that lead and "Approve"(No other approval is pedning) that lead and test again through vf page still it shows the same error.

NOW if I go to that lead  detail page and click on "Convert" button it shows me this page:
User-added image

After this I don't click on convert, I just go to the vf page and try to convert through apex class, and it converted succefully. SO I am not sure what is happening ?  Why my lead is not getting converted even I approve/reject , Is there any workaround of this? Please suggest.
 
I have a site with multiple pages and I am using request forwarding rather than sendRedirect, that means sendRedirect(false).
There's some weirdness where when an applicant goes to the next page, it loads the next page (correctly), but the URL up at the top of the browser still shows the URL value from the previous page (even though you are looking at the content from the next page).

I don't want to use the sendRedirect(false), Is there any solution to show correct URL when using sendRedirect(false)/Request Forwarding
 
 Conference Management App - Create a Lightning Component with Server-Side Apex Controller:

Step 5: Add Component to the Speaker Record Page
Click App Default and then Assign as App Default.
Select the Conference app, then click Next and then Save.
Question: Does anyone know why Conference Management App is not listed for selection?

User-added image
I am also getting this error when I verify the hands on challenge:Note all APEX codes saved without errors. and all other steps worked.
Step not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.QueryException: List has no rows for assignment to SObject

Thanks in advance for your help.
Challenge Not yet complete... here's what's wrong: 
The runWarehouseEquipmentSync method does not appear to have run successfully. Could not find a successfully completed @future job for this method. Make sure that you run this method at least one before attempting this challenge. Since this method is annotated with the @future method, you may want to wait for a few seconds to ensure that it has processed successfully.

here is my code

public with sharing class WarehouseCalloutService {
    
    private static final String WAREHOUSE_URL = 'https://th-superbadge-apex.herokuapp.com/equipment';
    @future(callout=true)
    // complete this method to make the callout (using @future) to the
    // REST endpoint and update equipment on hand.
    public static void runWarehouseEquipmentSync(){
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint(WAREHOUSE_URL);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        // If the request is successful, parse the JSON response.
        String ret = '';
        if (response.getStatusCode() == 200) {
            // Deserialize the JSON string into collections of primitive data types.
            List<Object> results = (List<Object>) JSON.deserializeUntyped(response.getBody());
            
            List<Product2> LstProduct = new List<Product2>();
            for(Object obj : results)
            { 
                Map<String, Object> mapobj = (Map<String, Object>)obj;
                Product2 product = new Product2();
                           
                Integer maintenanceperiod = (Integer)mapobj.get('maintenanceperiod');               
                Integer Lifespan = (Integer)mapobj.get('lifespan');
                Integer Cost = (Integer)mapobj.get('cost');
                Boolean replacement = (Boolean)mapobj.get('replacement');
                Integer quantity = ((Integer)mapobj.get('qIntegerntity'));
                product.Name  = (String)mapobj.get('name'); 
                product.Maintenance_Cycle__c = Integer.valueof(maintenanceperiod);
                product.Cost__c = Cost;
                product.Current_Inventory__c = quantity;
                product.Lifespan_Months__c = Lifespan; 
                product.Replacement_Part__c = replacement;
                product.Warehouse_SKU__c = (String) mapobj.get('sku');
                product.ProductCode = (String)mapobj.get('_id');       
                LstProduct.add(product);
            }
            
            System.debug(LstProduct);
             upsert LstProduct Warehouse_SKU__c;
        
        }
        
       
    }
}
Hello, I need help
I have these 2 custom objects
OT__c has an master relationship with the Pre_Factura__c
And I want to deploy this apex class into the Production but I get the code coverage error
but I don't know how to test this class, can someone help me pls?

 
public class OTRapidaController {

    public Pre_Factura__c prefactura;
    public OT__c ot;
      
    public Pre_Factura__c getPreFactura(){
        if(prefactura==null)prefactura=new Pre_Factura__c();
        return prefactura;
    }
    
    public OT__c getOT(){
        if (ot==null)ot=new OT__c();
        return  ot;
    }
               
    public PageReference save(){
 
        insert prefactura;
        
        ot.Pre_Factura__c=prefactura.Id;
        insert ot;
                       
        PageReference OTRapida = new ApexPages.StandardController(ot).view();
        OTRapida.setRedirect(true);
        return OTRapida;
    } 
}

 
Hi folks,
How to make visualforce page responsive?
Hi All,

I am using a email template, I wanted to put a hyperlink in this template named "Click on this".

When user click on this "Click on this" hyper link. User should it should redirect to the record/detail page.

This is very urgent. Please help.
 
Hi,

I am generating a PDF on case insert using trigger. I need to add an image and signature to it. Is it possible?
I am generating pdf like this


String pdfContents = '<html>';
pdfContents += UserInfo.getUserName();
pdfContents += '<div>';
pdfContents += '</body>';
pdfContents += '</html>';

Blob pdfBlob = Blob.toPDF(pdfContents);
 
Hi,

I am new to Salesforce. I have look thru the list of API available in Salesforce.
I need to get the data in Account and Contact as following into my Java application:
User-added image
Any suggestion which API I should focus and start on?
  • February 06, 2015
  • Like
  • 0
Hi,

I  have a method in a controller, which takes to the edit page of a contact where user can edit the contact and save.
How do i compare the old and new values of that contact ?

apex Controller
==============

public pageReference gotoContactEditPage()
{
             PageReference conEditPage = new PageReference('/' + contactId+ '/e');         
             conEditPage.setRedirect(true);
            // Here i want to compare the old and new values of contact (before save and after save)
             return conEditPage
           


}

 
Can some one please help me how to avooid the soql query in the last for loop to assign user id. Stuck on this

trigger COITrigger on Panel_Assignment__c (after insert, after update, after delete, before delete) {
    
    //If Panel Assignment is inserted then we have COI inserted along with Status as Active
    if(Trigger.isafter && trigger.isInsert){
       Set<Id> panelIds = new Set<Id>();
        list<COI_Expertise__c> coilist=new list<COI_Expertise__c>();
        for ( Panel_Assignment__c panelAssignment : Trigger.new) {
            // Store all panel's Id
            panelIds.add(panelAssignment.Panel__c);
        }
         //Below soql query fetches the related Research Applications
         //Also based on research applications the COI records are created for each reviewer assigned to the panel.
         
   list<Research_Application__c> r=[select id,Technical_Abstract__c from Research_Application__c where Panel__c=:panelIds];
       for(Research_Application__c ra:r){
           for(Panel_Assignment__c panelAssignment : Trigger.new){
        COI_Expertise__c  c=new COI_Expertise__c();
        c.Research_Application__c= ra.Id;
    c.Technical_Abstract__c=ra.Technical_Abstract__c;
           c.Active__c=true; 
         c.Reviewer_Name__c = panelAssignment.Reviewer_Name__c;
               

               user u=[select id,firstname,lastname from user where contactID=:c.Reviewer_Name__c];
                        c.OwnerId=u.Id;
           
               coilist.add(c);
                
               }
             }    
         
insert coilist;  
    }
  • February 05, 2015
  • Like
  • 0
I have the following custom setting: Payout__AH_FromToDate__c
 
I created two values in the Custom Settings panel:
payout__AH_From_Date__c
payout__AH_To_Date__c
 
 
In my APEX Class code:
 
237        Date frmdte;
 238       Date todte;
 
   239     frmdte = payout__AH_FromToDate__c.getValues('payout__AH_From_Date__c');
    240    todte  = payout__AH_FromToDate__c.getValues('payout__AH_To_Date__c');
 
    241    DateInput1.ActivityDate  = frmdte;
     242   DateInput2.ActivityDate  = todte;
 
Error: Compile Error: Illegal assignment from SOBJECT:payout__AH_FromToDate__c to Date at line 239 column 9
 
Can someone help me out as to what I need to do so that I can assign frmdte and todte to my custom setting date values?
 
Thanks.
 
 
Trying to deploy development from my sandbox using change sets. Whilst custom fields, tabs etc come across fine, the triggers are failing with the following error:

Code Coverage Failure Your organization's code coverage is 0%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.

This means nothing to me and I'm just getting more confused looking through the help documents. I don't really do code and I don't know where to start. Any help would be very much appreciated
How can i ignore the www. for not showing an error example (www.yahoo.com = yahoo.com; www.cs.org != www.cs.ph)
here is duplication method for my website. Thanks in advance

public static void checkDuplicateWebsite(List<Account> newRecord){
       for(Account a: newRecord){
           List<Account> account = [SELECT Id, Website FROM Account WHERE Website=:a.Website];
           if(account.size()>0){
               a.adderror('You cannot create a duplicate Website');
           }       
    }

I'm trying to copy a new user as contact by using a trigger but I'm getting the following error

 

MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User

 

trigger Acceleration_User_Copyto_Contact on User (after insert, after update) {
    
   // Map<String,User> newLead = new Map <String, User>();
    
    system.debug('Acceleration_User_Copyto_Contact Trigger....');
 
    for ( User user : System.Trigger.new)
    {
        if  (user.Email.contains('acceleration'))
        {
            system.debug('Acceleration_User_Copyto_Contact Trigger..2.');
            Integer RecordCount = [select count() from Contact c where c.Email = : user.Email];
            
            system.debug('Acceleration_User_Copyto_Contact Trigger..2a .' + RecordCount);
            
            if (RecordCount == 0)
            {
                String AccountId = '';
                for ( Account a : [Select a.Id From Account a where Name = 'Acceleration']) 
                {
                    system.debug('Acceleration_User_Copyto_Contact Trigger..3.');
                     
                    AccountId = a.Id;
                
                    Contact con = New Contact();
                    con.AccountId = AccountId ;
                    con.Email = user.Email;
                    con.Firstname = User.Firstname;
                    con.Lastname = User.Lastname ;
                    con.User__c = User.Id;
                    insert con;
                }          
            }                   
        }
        
     }
    
    
}