• Mrunali Gaonkar
  • NEWBIE
  • 25 Points
  • Member since 2014
  • salesforce developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 14
    Replies
Has anyone worked on Microsoft Authentication Library (MSAL V2.0)?
MSAL Link: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser

Scenario:
Users are using Microsoft credentials to access all the applications. I am trying to authenticate SharePoint URL from Salesforce. I have set up a Microsoft Azure application. Using MSAL, I am able to get the access token for the current logged-in Microsoft user account in Salesforce. When I try to authenticate SharePoint URL with an access token, I am getting 401 unauthorized error.

Does anyone have any idea about this? I am wondering if I need to do any application-specific changes in the Microsoft Azure application. Thanks.
 I want to display a lightning modal/popup to process the selected records in list view. Due to limitation, I am not able to use the lightning quick action/button with lightning component in list view. 

https://trailblazer.salesforce.com/ideaView?id=0873A000000lOKmQAM

https://trailblazer.salesforce.com/ideaView?id=0873A000000lGq5QAE

Workaround: I created a list view button with visualforce page. I am embedding the lightning component inside the visualforce page using lightning out. When I click the button it redirects to another page instead of displaying a popup. Is there any way to open a VF page on popup window in list view button?
 
When using email bounce management, If an email to the address for a contact, lead, or person account bounces, an alert shows up next to the email address.

User-added image

Does anyone have any workaround to have this similar functionality on other objects (In our case, its a Case object)? 
Does any one have idea to compare two text fields(alphanumeric)?
My requirement is Field1 should always be lesser than Field2.

For eg.
Scenario 1: 
Field1 is ABC000 and Field 2 is XYZ000. In this case, validation will not display an error.

Scenario 2:
Field1 is XYZ000 and Field 2 is ABC000. In this case, validation will  display an error.

Scenario 3: 
Field1 is XYZ006 and Field 2 is XYZ004. In this case, validation will  display an error.

Scenario 3: 
Field1 is XZZ006 and Field 2 is XYZ004. In this case, validation will  display an error.

Thanks!

 
I am working on validation for IPV4 and IPV6 to validate their input.
This IP input fields should also accept the subnet mask.

Valid input in IPV4 field can be :
172.16.0.0
172.16.0.0/8
172.16.0.0/192
213.248.89.98/31

Valid input in IPV6 field can be :
2001:db8:abcd:0012::0/64
2001:db8:abcd:0012:0000:0000:0000:0000
2001:2000:3080:001D::2/126

Is it something possible with regex or custom code? I tried couple of regex solutions but its not working. 
Hi,

following code is to generates 6 digit unique code i.e  strPassword  for web to lead using Lead Id and datetime value.This is working fine on sandbox as we create single record at a time.But what is probability that this following logic can fail on production??????? Code generated will be unique across or need to take some precaution to avoid errors.
// for loop over lead
strForEncryption =  String.valueOf(oLead.id) + String.valueOf(Datetime.now().formatGMT('yyyy-MM-dd HH:mm:ss.SSS')); 
blobHashCode = Crypto.generateDigest('MD5', Blob.valueOf(strForEncryption));
strHexDigest = EncodingUtil.convertToHex(blobHashCode);
strPassword = strHexDigest.substring(0,6);
                       
                     
Hi,

I am trying to send sms in apex trigger using smagicinteract package.its working fine after record updation but in test classes all execution goes fine and smagicinteract object also get inserted without errors as follwos
64]|DEBUG|listOfResonse(Database.SaveResult[getErrors=();getId=a11L00000079x1UIAQ;isSuccess=true;])
only am getting error at the end as follows,
13:35:41.615 (18615499664)|CODE_UNIT_FINISHED|Workflow:Lead
13:35:41.615 (18615705686)|DML_END|[31]
13:35:41.620 (18620308312)|ENTERING_MANAGED_PKG|smagicinteract
13:35:41.705 (18705643589)|FATAL_ERROR|System.SecurityException: Empty key

(System Code)




13:35:41.705 (18705665375)|FATAL_ERROR|System.SecurityException: Empty key

(System Code)
Hi,
following is the code which i am writing in my lead trigger to generate password.
i am not sure this number will be unique or not.. can any 1 help..

//fetching last accesscode.
          in for loop 
                        Integer len = 6;
                        String hashString = String.valueOf(accessCode) ;
                        Blob hash = Crypto.generateDigest('MD5', Blob.valueOf(hashString));
                        String hexDigest = EncodingUtil.convertToHex(hash);
                        String pwd = hexDigest.substring(0,len);
                        system.debug('##########' + pwd );
                        oLead.Access_Code__c = String.valueOf(pwd);
                        accessCode++;
Hi,
     The error is System.CalloutException: IO Exception: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at line
 SoapBindingStub bind = (SoapBindingStub) new SforceServiceLocator().getSoap();

But only in production - it works fine in the sandbox.What are the possible reasons ans solutions for this?
please help.
hi,
I want to write a code to get next Scheduled dates from given cron expression.For eg.
If input is : 0 0 20 * * ?
then output should be: Wednesday, May 27, 2015 8:00 PM
                                  Thursday, May 28, 2015 8:00 PM
                                  Friday, May 29, 2015 8:00 PM
                                  .
                                  .etc.
Please help to resolve this.
Thank you.
 
apex page


<apex:page standardController="Project_Name__c" extensions="GetAndMapWingPlantCodeController"> <apex:pageMessages /> <apex:form > <!-- <apex:pageblock rendered="{!blnResponseForPlantCode}"> --> <apex:pageblock rendered="{!blnNoAssociatedWings}"> <apex:pageBlockSection title="Map Wings to Plant code" columns="2"> <apex:repeat value="{!listWingPlantCode}" var="wing"> <apex:pageBlockSectionItem > <apex:outputLabel value="Cluster {!wing.objWing.Cluster__r.Name} Wing {!wing.objWing.Name}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:selectList value="{!wing.strPlantCode}" multiselect="false" size="1" required="true"> <apex:selectOptions value="{!plantCode}" /> </apex:selectList> </apex:pageBlockSectionItem> </apex:repeat> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!saveMapping}" value="Save" onComplete="window.self.close();"/> <apex:commandButton action="{!cancel}" value="Cancel" onComplete="window.close();"/> </apex:pageBlockButtons> </apex:pageblock> </apex:form> </apex:page>


apex class

public class GetAndMapWingPlantCodeController {
    
    // Variables
    String projectId;
    public List<Wing__c> listWing = new List<Wing__c>();
    public List<Project_Name__c> listProject = new List<Project_Name__c>();
    //public boolean blnIncorrectPlantMapping;
    private ApexPages.StandardController stdController;
    String returnMsg;
    
    // Properties
    public List<WingPlantCodeMapping> listWingPlantCode {get; set;}
    public Map<String, List<Wing__c>> mapPlantCodeWing {get; set;}
    public boolean blnResponseForPlantCode {get; set;}
    public boolean blnNoAssociatedWings {get; set;}
    public boolean blnIncorrectPlantMapping {get; set;}
    public WingPlantCodeMapping objWingPlantCode {get; set;}
    public List<String> listPlantCode {get; set;}
   
    //public List<String> listPlantCode {get; set;}
    
    // final variables
    private static final String SAP_AUTH_USERNAME = System.Label.SapAuthUsername;
    private static final String SAP_AUTH_PASSWORD = System.Label.SapAuthPassword;
    
    public GetAndMapWingPlantCodeController(){}
    
    //Constructor
    public GetAndMapWingPlantCodeController(ApexPages.standardController objStdController){
        
        // Initialization
        blnResponseForPlantCode = true;
        blnIncorrectPlantMapping = false;
        blnNoAssociatedWings = true;
        listWingPlantCode = new List<WingPlantCodeMapping>();
        objWingPlantCode = new WingPlantCodeMapping();
        listPlantCode = new List<String>();
        
        stdController = objStdController;
        projectId= objStdController.getId();
        
        listProject = [select id,
                              Name, 
                              Sales_Organization__c 
                       from Project_Name__c 
                       where id = :projectId];
        
        if(!listProject.isEmpty()){
            listWing = [select id, 
                               Name, 
                               Project__c, 
                               Cluster__r.Name, 
                               SAP_Plant_Code__c 
                        from Wing__c 
                        where Project__c = :listProject[0].Name];
        
            // If wings are created for this project then
            // consume the SAP webservice to get the plant code for each wing
            if(!listWing.isEmpty()){
                InitializeListWingPlantCode(listWing);
                // Calling the SAP WSDL method to get the plant code
                try{
                    returnMsg = callInventoryService(projectId);
                    if(!String.isBlank(returnMsg)){
                        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, returnMsg));
                        blnResponseForPlantCode = false;
                    }
                    else
                        blnResponseForPlantCode = true;
                }
                catch(Exception e){
                    blnResponseForPlantCode = false;
                    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Exception : ' + e));
                }
            }// end of listWing.isEmpty()
            else{
                blnNoAssociatedWings = false;
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'There are no wings associated with this Project.'));
            }
        } // end of if(listProject.isEmpty)
    } 
    
    // Method to create the select list of the Plant codes.
    public List<SelectOption> getPlantCode(){
   
        List<SelectOption> plantCodeOptions = new List<SelectOption>();
        plantCodeOptions.add(new SelectOption('','-None-'));
        system.debug('listPlantCode'+listPlantCode);
        //Mrunali Gaonkar
        if(!listPlantCode.isEmpty()){
          for(String strItem : listPlantCode){
              plantCodeOptions.add(new SelectOption(strItem,strItem));
          }
          return plantCodeOptions;
        }else{
            return null;
        }
    }
    
    // Method to create the list of Wing and corrosponding Plant Code
    public void InitializeListWingPlantCode(List<Wing__c> pListWing){
        
        for(Wing__c wing : pListWing){
            objWingPlantCode = new WingPlantCodeMapping();
            objWingPlantCode.objWing = wing;
            objWingPlantCode.strPlantCode = '';
            listWingPlantCode.add(objWingPlantCode);
        }        
    }
    
    // Method to save the Palnt corrosponding to the wing
    public void saveMapping(){
        
        String strPlantName;
        List<Wing__c> listWingForSamePlantCode = new List<Wing__c>();
        List<Wing__c> listWingToUpdate = new List<Wing__c>();
        mapPlantCodeWing = new Map<String, List<Wing__c>>();
        
        if(!listWingPlantCode.isEmpty()){ 
            
            for(WingPlantCodeMapping objWingPlant : listWingPlantCode){
                strPlantName = objWingPlant.strPlantCode;
                listWingForSamePlantCode = new List<Wing__c>();
                
                for(WingPlantCodeMapping objWingPlant1 : listWingPlantCode){
                    if(strPlantName.equals(objWingPlant1.strPlantCode)){
                        listWingForSamePlantCode.add(objWingPlant1.objWing);
                        objWingPlant1.objWing.SAP_Plant_Code__c = objWingPlant1.strPlantCode;
                        listWingToUpdate.add(objWingPlant1.objWing);
                    }
                }
                if(!listWingForSamePlantCode.isEmpty())
                    mapPlantCodeWing.put(strPlantName, listWingForSamePlantCode);
            }
        
            // Checking whether if two wings are associated with one plant code
            //MRUNALI GAONKAR 22/04/2015 to allow more than 1 wing 
            /*for(String strPlant : mapPlantCodeWing.keyset())
            {
                if(mapPlantCodeWing.get(strPlant).size() > 1){
                    blnIncorrectPlantMapping = true;
                    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Same plant code is mapped to more than one wing.'));
                    break;
                }
                
            }*/
            
            if(!blnIncorrectPlantMapping){
                if(!listWingToUpdate.isEmpty())
                    Database.Saveresult[] result = Database.update(listWingToUpdate);
                Database.Saveresult[] resultProjectName = Database.update(listProject);
            }
        }
    }
    
    // Cancel Method
    public PageReference cancel(){
        stdController.cancel();
        return ApexPages.currentPage();
    }
    
    // Inner class for mapping wing and plant code selection
    public class WingPlantCodeMapping{
        
        public Wing__c objWing {get; set;}
        public String strPlantCode {get; set;}
        
        public WingPlantCodeMapping(){
            objWing = new Wing__c();
            strPlantCode = '';
        }
    }
    
    //method to perform callout to the SAP Webservice
    public String callInventoryService(Id pProjectId){
    
        String returnMsg = '';
        
        SAPINTPlantCodeGeneration.ZSD_FM_GET_PLANT_SFDC_IDResponse_element objResponse = 
                                                        new SAPINTPlantCodeGeneration.ZSD_FM_GET_PLANT_SFDC_IDResponse_element();
        
        SAPINTPlantCodeGeneration.ZSD_FM_GET_PLANT_SFDC_ID oGetPlantSfdcId = new SAPINTPlantCodeGeneration.ZSD_FM_GET_PLANT_SFDC_ID();
        
        oGetPlantSfdcId.inputHttpHeaders_x = new Map<String,String>(); 
        
        String strAuthorizationHeader = 'Basic ' + Encodingutil.base64Encode(Blob.valueOf(SAP_AUTH_USERNAME + ':' + SAP_AUTH_PASSWORD));
        oGetPlantSfdcId.inputHttpHeaders_x.put('Authorization', strAuthorizationHeader);
        
        //Siddharth 1.1
        String strProjectId = (String.valueOf(pProjectId)).subString(0,15);
        System.debug('========== Project Id ' + strProjectId);
         
        objResponse = oGetPlantSfdcId.ZSD_FM_GET_PLANT_SFDC_ID(strProjectId, new SAPINTPlantCodeGeneration.TABLE_OF_ZSDT_COMP_PLNT1_STRU());
        System.debug('=========== Response ' + objResponse);
        
        for(SAPINTPlantCodeGeneration.ZSDT_COMP_PLNT1_STRU item1 : objResponse.IT_OUTPUT.item){
            System.debug('================== item ' + item1);
        }
        
        System.debug('===================== BAPIRET 1 ' + objResponse.RETURN_x);
        
        if(objResponse != null){
            listPlantCode = new List<String>();
            if(objResponse.IT_OUTPUT != null){
                if(objResponse.IT_OUTPUT.item != null){
                    for(SAPINTPlantCodeGeneration.ZSDT_COMP_PLNT1_STRU item : objResponse.IT_OUTPUT.item){
                        listPlantCode.add(item.WERKS);
                    }
                 //mrunali gaonkar.  
                for(SAPINTPlantCodeGeneration.ZSDT_COMP_PLNT1_STRU item1 : objResponse.IT_OUTPUT.item){
                    System.debug('================== item ' + item1);
                    if(item1.VKORG != null){
                      listProject[0].Sales_Organization__c = item1.VKORG;
                    }
                }
                    //listProject[0].Sales_Organization__c = objResponse.IT_OUTPUT.item[0].VKORG;
                    system.debug('Sales_Organization__c@@'+listProject[0]+'objResponse##'+objResponse.IT_OUTPUT.item[0].VKORG);
                    blnResponseForPlantCode = true;
                }
                else{
                    blnResponseForPlantCode = false;
                    returnMsg = 'No plant codes returned from SAP.';
                }
            }
        }
        return returnMsg;
    }
}
Update failed. First exception on row 1 with id a1IL0000003CZE4MAO; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, FlatTrigger: execution of AfterUpdate caused by: System.QueryException: sObject type 'Parking_Inventory__c' is not supported. Class.UpdateParkingInventoryStatusHelper.updateParkingInventoryStatus: line 29, column 1 Class.FlatTriggerHandler.onAfterUpdate:
hi,
 i moved some part of code of v page to component.i accesed same controller that used in vpage in component on Case object..all command buttons exist on vpage only.. only some portion of vpage getting reused ,hence i want to move this into component.. bt not able to create a link between all together..should i create a new controller for this?? plzz help.. thank you..
Does any one have idea to compare two text fields(alphanumeric)?
My requirement is Field1 should always be lesser than Field2.

For eg.
Scenario 1: 
Field1 is ABC000 and Field 2 is XYZ000. In this case, validation will not display an error.

Scenario 2:
Field1 is XYZ000 and Field 2 is ABC000. In this case, validation will  display an error.

Scenario 3: 
Field1 is XYZ006 and Field 2 is XYZ004. In this case, validation will  display an error.

Scenario 3: 
Field1 is XZZ006 and Field 2 is XYZ004. In this case, validation will  display an error.

Thanks!

 
I am working on validation for IPV4 and IPV6 to validate their input.
This IP input fields should also accept the subnet mask.

Valid input in IPV4 field can be :
172.16.0.0
172.16.0.0/8
172.16.0.0/192
213.248.89.98/31

Valid input in IPV6 field can be :
2001:db8:abcd:0012::0/64
2001:db8:abcd:0012:0000:0000:0000:0000
2001:2000:3080:001D::2/126

Is it something possible with regex or custom code? I tried couple of regex solutions but its not working. 
I have a look up called Credit Rating and that is supposed to generate Ids such as AB4, CB5. I am writing an apex class that derives these IDS based on other nuerical fields. However, I am making a string and the string has to be assigned to the Id data type as the field Credit Rating is a look up field with data type Id. I tried to cast it like this but it keeps showing me this error
"System.StringException: Invalid id:  AD6()" , please help.
User-added image
 
I've got a CronTrigger entry on a customer's site that has an empty CronJobDetailId that's probably preventing a new System.scheduleBatch() call from running. When I run:
  System.abortJob('08e9000000rydbcAAA');

An exception is thrown:
  System.StringException: Invalid parameter value "000000000000000" for parameter "id".

How can I abort this job?

- Thanks
Hello guys,
I have these trigger and a helper clas to help stop firing more than once, but seems something doesn't work like it should, can someone point me where I am wrong. Thank you!

Trigger:
trigger AccountTrigger1 on Account (after update,after insert) {
       
    
     if(!HelperClass.hasAlreadyfired()){
    List<Account>listAccounts = new List<Account>();
        
    //Во for-циклусот листаме низ сите профили
        //за кои се проверува условот од if
    for(Account a : Trigger.new){
        
        //Се креираат 5 нови профили, доколку условот:
        // a.CheckPayment__c == True е исполнет
        if(a.CheckPayment__c == True){
            
            //Со секоја итерација на for - циклусот се креира по еден профил
            //for - циклусот завршува со креирање на нови профили кога 
            //итераторот i ќе ја достигне својата максимална вредност
            //во овој случај 5
            for (Integer i=0; i<5; i++){
               
                //Креирање на профил
                Account account = new Account();
                account.Name = 'Akaunt' + i;
                account.First_Name__c = 'Acount1';
                account.Second_Name__c = 'Surname1';            
                account.Status__c = 'Idle';
                listAccounts.add(account);
            }
         }
        //Додавање на профилите
        insert listAccounts;
     }
    }
    HelperClass.setAlreadyfired();
}
Ignore the comments :)

HelperClass:
 
public class HelperClass{
    public static boolean flagvalue = false;


    public static boolean hasAlreadyfired() {
        return flagvalue;
    }
    
    public static void setAlreadyfired() {
        flagvalue = true;
    }



}


 
  • June 05, 2015
  • Like
  • 0
IF(OR(NOT(ISBLANK(Order_Value__c)),NOT(Order_Value__c=0)), (IF(Order_Value__c>Actual_Cost__c),((Order_Value__c-Actual_Cost__c) / Order_Value__c),((Actual_Cost__c-Order_Value__c) / Order_Value__c)),0)


Syntax error missing ')' Any one know replay me.

public class A{
  public class B {
  }
  public class C {
       public A.B show(){}
  }
}

------------
Look above exampe. I have one inner class C.I need to create instance of that class.
Can any one help me to create instance of class C and call method show of class C.

 
hi i want to validate a phone number field of phone datatype. now my rule is phone number must be a 10 digit number  and it should not be a blank one .....now i used formula NOT(LEN(PHONENUMBER_C)=10).NO THERE IS NO SYNTAX ERROR AND SAVED THE RULE .WHEN I ENTERING IN PHONENUMBER FILED LIKE 9966055438 IT IS A TEN DIGIT NUMBER SO MY RECORD WILL HAVE TO SAVE .BUT AN ERROR WILL COME WHILE SAVING IT AND THAT PHONENUMBER IN DAT FIELD SHOWS LIKE DIS (996) 6055-438.IT IS NOT SAVING WHY THIS HAPPENING ? CAN ANY ONE TELL ME THE REASON   
How to get selected pick list values in apex
Looking for a Validation Rule when a picklist value is selected, 1 of 3 multipicklist fields must have a selection but if all 3 of the Multipicklist fields are left blank when user selects Save, user to receive an error, on all 3 Multi-picklist fields . 

Picklist API Name: Staged
Picklist value: Completed

#1 MultiPicklist API Name: Competition
#2 Multi-Picklist API Name: Moving
#3 Multi-Picklist API Name: Going

Here is what's been created so far to work on a single Multi-Picklist field when left blank:
 
AND(ISPICKVAL(Stage, "Completed"), ISBLANK(Competition__c))

Thanks Kevin Lam for the inital VR above http://sforce.co/1GXIt0c 
Update failed. First exception on row 1 with id a1IL0000003CZE4MAO; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, FlatTrigger: execution of AfterUpdate caused by: System.QueryException: sObject type 'Parking_Inventory__c' is not supported. Class.UpdateParkingInventoryStatusHelper.updateParkingInventoryStatus: line 29, column 1 Class.FlatTriggerHandler.onAfterUpdate: