• Nishad K
  • NEWBIE
  • 213 Points
  • Member since 2016

  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 62
    Replies
Hi Team,

Need Help. My requirement is to create a custom field as color picker. i.e example. I have created a custom object named color Picker and created a custom field "Color" . From that field, just like lookup or calendar picker, I want to select color. Is it possible?

 
What is a method for adding content to Salesforce CRM content? (2 answers)
a.            Attachments
b.            Chatter files
c.             Libraries
d.            Documents
 
The following code gives me an error because the final character for the string '<img src="data:image\' contains \

How do I fix this?

myLog.EmailHTML__c.replaceAll('<img src="data:image\', '<img src="data:image/');
  • February 07, 2017
  • Like
  • 0
Hi,

I have an old system which as ID for a table and I have created auto number ID field for an object in salesforce. 
Can I map them while data importing? 

TIA
  • January 31, 2017
  • Like
  • 0
I have a  scenario-
 
There are 2 objects-
 
SalesInfluenceReportings : It is loaded with data corresponding to CMT.
Masters : It is loaded with master data for all types of OG.
 
Now, we need to have a relationship and based on MMS Id from SalesInfluenceReportings and Opportunity Id from Masters these should be related.
 
I have created a trigger on after insert/update to populate the field but it is not updating. Can you please look into the code and help me if I am missing something.
Trigger Name : updateMaster


trigger updateMaster on SalesInfluenceReporting__c (after insert, after update) {
 
  Map<Id, String> idMap = new Map<Id, String>();
  Boolean matchOnce = false;

    for(SalesInfluenceReporting__c obj :trigger.new)

    {
        idMap.put(obj.Name,obj.MMS_Id__c);
        
        system.debug('********'+idMap);
       
     }
     
     

 List<Master__c> mList =[Select Id,Opportunity_Id__c from Master__c ]; 
    
 List<SalesInfluenceReporting__c > ul = new List<SalesInfluenceReporting__c >();
 
 for(SalesInfluenceReporting__c obj :trigger.new)
{
     for(Master__c m :mList ){
        
           SalesInfluenceReporting__c  rectoUpdate = new SalesInfluenceReporting__c ();
                system.debug('+++++++++'+idMap.get(obj.id));
                if(matchOnce == false){
                if(m.Opportunity_Id__c == idMap.get(obj.id)){
                rectoUpdate.Id = obj.id;
                rectoUpdate.Master__c = m.id;
                matchOnce = true;
                ul.add(rectoUpdate );  
                system.debug('-------'+rectoUpdate );   
           }
          }
         break;
      }
   }
    system.debug('@@@@@@@@'+ul);
    update ul;
}

Can someone tell me where im wrong its not updating .

Thanks
Vijaykumar.S
Hi
i have used a text formula field but it has some error in the formula
IF(ispickval(Sub_type__c, "Saas"), "6",
   if(ispickval(Sub_type__c, "On-Prem"), "12","None"
   )
)

Error: Field Sub_type__c may not be used in this type of formula

i have used case also it is also displaying same error

plz help to sort out this plz

Thanks & Regards
Pratyusha k
 
I had created a web tab to redirect it to gmail page by giving the url but it is showing a blank page. plz help me 
While we trying to update the Lightning components API version  39 to 40, this will break  many more places in the code,

Currently, our Lightning components are in v38 and all working fine when i update to v39 it also working fine .But update toV40 it breaks,
I know it's due to the salesforce  locker service. I need all Lightning components in v40 because  I want to publish these components to AppExchange, when i submit in v39 salesforce rejecting the components due to the API version.
can anyone help me with this
 
Hi Experts 

How can we call SAP BAPI from salesforce?
Hi Experts, 

How to SAP BAPI from salesforce?
Hi Team,

Need Help. My requirement is to create a custom field as color picker. i.e example. I have created a custom object named color Picker and created a custom field "Color" . From that field, just like lookup or calendar picker, I want to select color. Is it possible?

 
Hi Expert,

I want to add Lead in Campaign, but i have a  DML error.
 
String searchItem = selectedValue;
 List<Lead> l = [SELECT id,leadsource FROM LEAD WHERE Name = :selectedValue];
 String cname = l[0].leadsource;

 List <CampaignMember> cm = new list<CampaignMember>();
 Campaign c = new Campaign(name = cname);
 insert c;

 CampaignMember cml = new CampaignMember();
 cml.campaignid = c.id;
 cml.leadid = l[0].id;
 cm.add(cml);
 insert cm;
Please suggest.

Thanks
Mukesh
 
I have created a check box on the contact object,when ever i create a new record on contact the previous record checkbox field must be unchecked automatically
could some one help me ,how to write a trigger
Hello Everyone,

I am trying to create a trigger that updates a picklist field on the Account object whenever that account has a Par_Level__Line__c created for a particular family of products.  The custom object, Par_Level_Lines__c, has a lookup relationship to the Account object.  The custom field on account is named Allocation_Review_Week__c.  Here is the trigger code I have written so far:

 
trigger AllocationReviewWeek on Par_Level_Lines__c (after insert){
    List <ID> AccountsID = new List<ID>();
    for(Par_Level_Lines__c o : Trigger.new){
        if(o.Product_Family__c = 'Our Products' && Par_Level_Lines__c.Account__c.Allocation_Review_Week__c == null){
            AccountsID.add(Par_Level_Lines__c.Account__c.ID);
        }
    }
    List<Accounts> AcctUpdate = [Select id, Par_Level_Lines__c.Account__c FROM Account Where id in : AccountsID];
        for(integer i = 0 ; i < AcctUpdate.size(); i++){
            AcctUpdate[i].Par_Level_Lines__c.Account__c.Allocation_Review_Week__c = "1";
        }
        update AcctUpdate;
}

I keep hitting a compiler error on the 8th line of code.  Thanks in advance for any help.
A developer needs to create a Visualforce page that will override standard Account edit button. The page will be used to validate the account's address using a SOQL query.The page will also allow the user to make edits to the address.
Where would the developer write the Account address verification logic?

A. In a Controller Extension.
B. In a Custom Controller.
C. In a Standard Controller.
D. In a Standard Extension.
  • February 16, 2017
  • Like
  • 0
Hi There,

Can anybody tell me how to run dataloader in batch mode.


Thanks.
I have developed a Visualforce page to render in PDF and i use @page css for my repeating header and my header content contain a table with border-right:1px solid.

this is my CSS:
 
html * {
  font-family: Arial Unicode MS;
  font-size:12px;
}

@page {
  size: A4;
  margin: 25pt .5in .5in .5in;
  margin-top:220px;
  margin-bottom:130px;

  @top-left{
    content: element(header-left);
  }
  @top-right{
    content: element(header-right);
  }
  @bottom-left {
    content: element(footer-left);
  }
  @bottom-right {
    content: element(footer-right);
  }
  @top-center{
    content: element(header-content);
  }
  @bottom-center{
    content: element(footer-content);
  }
}

@page :first{
  size: A4;
  margin: 25pt .5in .5in .5in;
  margin-top:190px;
  margin-bottom:130px;

  @top-center{
    content: element(header-cover);
  }
  @bottom-center{
    content: element(footer-cover);
  }

}

div.header-right {
  position: running(header-right);
  display: block;
  padding: 10px;
}
div.header-left {
  position: running(header-left);
  display: block;
  padding: 10px;
  font-size:40px;
}
div.header-cover {
  position: running(header-cover);
  display: block;
  padding: 10px;
}

div.header-content {
  position: running(header-content);
  display: block;
  padding: 10px;
}


div.footer-content {
  position: running(footer-content);
  padding: 10px;
  display: block;
}
div.footer-cover {
  position: running(footer-cover);
  padding: 10px;
  display: block;
}

div.footer-right {
  position: running(footer-right);
  padding: 10px;
  display: block;
}

td.pageHeaderCompany{ /*****NEW*****/
  text-align:left;
  font-weight: bold;
  font-size:20px;
  font-family:sans-serif;
  color:#83bc34;
  letter-spacing:normal;
  vertical-align: top;
}


td.footerLabel{
  font-size: 10px;
  text-align:right;
}
td.footerContent{
  font-size: 10px;
  text-align:left;
  padding-left:15px;
}

tr.pageHeader{ /*****NEW*****/
  font-size:12px;
  color:#001fa4;
  letter-spacing:normal;
  vertical-align: top;
}

tr.stdstyle{
  text-align:left;
  letter-spacing:normal;
  vertical-align: top;
}

this my visualforce page:
 
<html>
<head>
  <style type="text/CSS" media="print">
    <apex:outputPanel layout="none" rendered="{!!(Quote.status == 'Approved')}">
      .watermark {
        background-repeat: repeat;
        background-image: url("{!URLFOR($Resource.Quote_Watermark)}");
      }
    </apex:outputPanel>
  </style>
</head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

<body class="watermark">
    <div class="header-content">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td style="width:60%;">&nbsp;</td>
    <td style="width:40%; align:right">
      <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td style="border-right: 1pt solid #001fa4;">text</td>
            <td >text</td>
          </tr>
          <tr>
            <td style="border-right: 1pt solid #001fa4;">text2</td>
            <td >text2</td>
          </tr>
      </table>
    </td>
  </tr>
</table>
</div>

<page body content here../>  
</body>
</html>

The header is ok on the first page, but when on the second page and beyond, the table border is gone. Just pure table & content without border.
How can i remain the table border for every page?
 
If a contact is not associated with any of the account, I want to create an Account via Trigger . 
Basically I want three operations:
1. Insert a Contact record
2. Then Account will be inserted
3. Then link contact to Account 


This is my code
trigger createAccount on Contact (before insert) {

List<Contact> conlist = new List<Contact>();

    for(Contact c : Trigger.New)
        {
            if(c.accountId == null)
            {
                conlist.add(c);
            }
        }
    if(conList.size()>0)
        {
            List<Account> acclist = new List<Account>();
            Map<String,Contact> conmap = new map<String,Contact>();
            
            for(Contact c : conList)
            {
                String accountName = c.firstname+' '+c.lastname;
                Account a = new Account(name=accountname);
                accList.add(a);
            }
          insert accList;
          
              for(Account a : acclist)
              {
                  if(conmap.containskey(a.name))
                  {
                      conmap.get(a.name).accountId = a.id;
                  }
              }
        }

}
Hi,

I have wrote a trigger to send an attachment once the Account Field 'Status' field value changed to 'Approved/Submitted to BA' OR 'Paperwork Complete'.
All is working fine except it is attaching the document 2 times, we have to attach only one time.

trigger SendAttachmentonAccount on Account (after update) 

    List<Account> lstGreensheet = new List<Account>();
    system.debug('======= AccountAttachment Started =============');
    Account AccountOld = trigger.old[0];
    Account AccountNew = trigger.new[0];
    system.debug('AccountOld '+ AccountOld.get('Status__c'));   
    system.debug('AccountNew '+ AccountNew.get('Status__c'));
        
    if((AccountOld.get('Status__c') != AccountNew.get('Status__c')) && 
       (AccountNew.get('Status__c') == 'Approved/Submitted to BA' ||
        AccountNew.get('Status__c') == 'Paperwork Complete' ))
        {
        
            generateAccountPDF.attachingPDFOnStatusChange((String)AccountNew.get('Id'),(String)AccountNew.get('Name'));    
               
        }
        system.debug('======= Account Attachment Completed =============');  
}
What is a method for adding content to Salesforce CRM content? (2 answers)
a.            Attachments
b.            Chatter files
c.             Libraries
d.            Documents
 
Hi All,

Facing the issues like getting a System.LimitException: Too many SOQL queries: 101 when trying to update my opportunities. Can someone please help me on this code, so we don't run into this error anymore and how to avoid it again with future Triggers.
Please check my below Trigger and class:
Trigger:
Trigger AccountPartnerType on Account (after update){
    AccountPartnerTypecls acpt = new AccountPartnerTypecls();
    if(AccountPartnerTypecls.Aptcalc)
    acpt.AccountPartnerTypecalc(Trigger.new,trigger.newmap,trigger.oldmap);
}
Class:
public class AccountPartnerTypecls{
                public static Boolean Aptcalc = true;
                public static Boolean Aptcalc1 = false; 
                public static Boolean Aptcalc2 = false;  
                public void AccountPartnerTypecalc(List<Account> aclist,map<id,Account> newmap,map<id,Account> oldmap){
                                set<id> accidset = new set<id>(); 
                                set<string> ulprntidset = new set<string>();   
                                string dulprnt;
                                map<string,List<Account>>  accmap = new  map<string,List<Account>>();
                                system.debug('*********'+aclist.size());           
                                for(Account acc: aclist){
                                                accidset.add(acc.id);
                                                // if(acc.GE_Global_Ultimate_Reporting_Account__c!=Null)  //GE_Digital_Ultimate_Parent_ID__c
                                                //Ultimate_Parent_ID__c
                                                ulprntidset.add(acc.GE_Digital_Ultimate_Parent_ID__c);
                                                dulprnt= acc.GE_Digital_Ultimate_Parent_ID__c;
                                                system.debug('*********'+dulprnt);           
                                }
                                system.debug('*********'+dulprnt); 
                                List<Account> hiracclist = new List<Account>();
                                List<Account> aclist1 = [select id, name,Partner_Status__c,Is_Partner__c,Account_Type__c,Parentid,GE_Digital_Ultimate_Parent_ID__c from Account where  GE_Digital_Ultimate_Parent_ID__c  =:dulprnt  AND Parentid!=null AND id NOT IN:accidset ];
                                system.debug('*********'+aclist1.size()); 
                                for(Account a : aclist1 ){
                                                if(accmap.containskey(a.GE_Digital_Ultimate_Parent_ID__c))
                                                accmap.get(a.GE_Digital_Ultimate_Parent_ID__c).add(a);
                                                else{
                                                                List<Account> alist = new List<Account>();
                                                                alist.add(a);
                                                                accmap.put(a.GE_Digital_Ultimate_Parent_ID__c,alist);
                                                }
                                }
                                for(Account acc: [select id, name,Partner_Status__c,Is_Partner__c,Account_Type__c,Parentid,GE_Digital_Ultimate_Parent_ID__c from Account where ID IN :accidset ]){
                                                string acctype='';
                                                if(accmap.get(acc.GE_Digital_Ultimate_Parent_ID__c)!=null){
                                                                /* if(accmap.get(acc.GE_Digital_Ultimate_Parent_ID__c).contains(acc)){
                                                                accmap.get(acc.GE_Digital_Ultimate_Parent_ID__c).set(0, acc);
                                                                accmap.get(acc.GE_Digital_Ultimate_Parent_ID__c).remove(0);
                                                                }*/
                                                                for(Account acchr : accmap.get(acc.GE_Digital_Ultimate_Parent_ID__c)){
                                                                                //acchr.Is_Partner__c= acc.Is_Partner__c;
                                                                                if(acc.Is_Partner__c)
                                                                                acchr.Account_Type__c = 'Partner';
                                                                                else
                                                                                acchr.Account_Type__c= '';
                                                                                hiracclist.add(acchr);
                                                                }
                                                                if(acc.Is_Partner__c){
                                                                                if(acc.parentid!=null)
                                                                                Aptcalc1 =true;
                                                                                acc.Account_Type__c= 'Partner';
                                                                                hiracclist.add(acc);
                                                                }
                                                                else{
                                                                                if(acc.parentid!=null)
                                                                                Aptcalc2 =true;
                                                                                acc.Account_Type__c= '';
                                                                                hiracclist.add(acc);
                                                                }
                                                }
                                                else{
                                                                if(acc.Is_Partner__c){
                                                                                acc.Account_Type__c= 'Partner';
                                                                                hiracclist.add(acc);
                                                                }
                                                                else{
                                                                                acc.Account_Type__c= ' ';
                                                                                hiracclist.add(acc);
                                                                }
                                                }
                                }
                                Account a=  [select id, name,Partner_Status__c,Is_Partner__c,Account_Type__c,Parentid,GE_Digital_Ultimate_Parent_ID__c from Account where ID  =:dulprnt];
                                if(Aptcalc1){
                                                a.Account_Type__c= 'Partner';
                                                hiracclist.add(a);
                                }
                                else if(Aptcalc2){
                                                a.Account_Type__c= '';
                                                hiracclist.add(a);
                                }
                                Aptcalc = false;         
                                update  hiracclist;
                }
}
 
Thanks
 
I am getting Unabe to Lock Row wile inseting reocrods - 

1. I am fetching Inventory reserve records form database by using SOQL query. Inventory reserve has a look up of sales order line. -> So I am gettinh SO Lines from inventory reserves.-> I am updating list of sales order lines 
I am gettig unable to lock row while updating sales order line.

I can use "FOR UPDATE" key word while quering Inventory reserve records, but my doubt that error is coming while updating sales order lines , so It will work??

Thanks
Ranu
 
<apex:page controller="BasicForm">
 <style type="text/css">
       td{
       padding:0px 15px 15px 15px;
}
    </style>

<apex:form >
<table>



<tr>

<td><apex:outputLabel value="AccountNumber" for="theCheckbox2" style="font-weight:bold"/><apex:inputfield value="{!act.Name}" id="theCheckbox2"  /></td>
<td><apex:outputLabel value="Phone" for="theCheckbox3"/><apex:inputfield value="{!act.phone}" id="theCheckbox3" /></td>
<td><apex:outputLabel value="Phone" for="theCheckbox1"/><apex:inputfield value="{!act.phone}" id="theCheckbox1" /></td>
<td><apex:outputLabel value="AccountNumber" for="theCheckbox4" style="font-weight:bold"/><apex:inputfield value="{!act.AccountNumber}" id="theCheckbox4"  /></td>
</tr>


</table>
</apex:form>


</apex:page>

 
Hi Dev's

Q). What are the methods in batch apex and which method runs in synchronous mode?

Regards
Narasimha
How to require certain picklist values, when a date field is populated?
trigger Customer_After_Insert on APEX_Customer__c (after update)
{
(*)List InvoiceList = new List();
for (APEX_Customer__c objCustomer: Trigger.new)
{
if (objCustomer.APEX_Customer_Status__c == 'Active')
{
APEX_Invoice__c objInvoice = new APEX_Invoice__c();
(*)objInvoice.APEX_Status__c = 'Pending';
(*) InvoiceList.add(objInvoice);
}
}
}
Can SomeOne Explain me the code flow speciall the "(*)"->Points