• Priyesh Misquith 12
  • NEWBIE
  • 50 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 4
    Replies
How can i pass the following value from apex  and display in VF page.

I have an object array  
 Object[] ObjArray = new Object[] {}; 
and the values are stored in the following format 
({wrapoffering:[URL=null, childTitle=({wrapchildOffering:[childImageUrl=null, childTitle=ABC, childURL=https://google.com]}), imageUrl=https://google.com,parTitle=Website], 
wrapoffering:[URL=null, childTitle=({wrapchildOffering:[childImageUrl=null, childTitle=DEF, childURL=https://google.com]}), imageUrl=https://google.com, parTitle=Website], wrapoffering:[URL=null, childTitle=({wrapchildOffering:[childImageUrl=null, childTitle=GHI, childURL=https://google.com]}), imageUrl=https://google.com, parTitle=Website]})

Now i want to display these values in the VF page.

Please suggest me how can i display this values. 

 
List<Contact> lstContact = [select id,firstName,LastName,accountId from contact where accountid in :stAccId ];

Map<String,List<Contact>> mapAccountWiseContact = new Map<String,List<Contact>>();

For(Contact cont : lstContact)
{
	if(mapAccountWiseContact.containsKey(cont.accountId))
	{
		List<Contact> lstCont = mapAccountWiseContact.get(cont.accountId);
		lstCont.add(cont);
	}
	else
	{
		List<Contact> lstCont = new List<Contact>();
		lstCont.add(cont);
		mapAccountWiseContact.put(cont.accountId,lstCont);
	}
}

What does if and else part does.
Hi,

I am converting the visualforce page into the Lightning Web Component.
How can I use the following bootstrap and Angular reference in LWC.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://www.google.com/recaptcha/api.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css" />
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

I am building the community page and I need this for the home page development.
I want to migrate the files from library of one sandbox to another.
library cointains the pdf files and images userd for developent of partner portal .
could any one guide me how can i migrate the library files.
Hi is there any possible way to provide  access for opportunity to the customer community user.
So that he can create and view his opportunity.
I have a map like this which cointain the all the value like id=userid and the values from account field (Account.abc__c
)and case field(Case.xyz__c).

map<Id,list<String>> UserwithCars = new map<Id,list<String>>();

Case.xyz__c (consider it as a brand)
Account.abc__c (consider it as sub-brand)


when user creates the case record  with the account 

I want to strore the userid of the user based on the Case.xyz__c value to the below 
ie is if the UserwithCars map cointains the value which is present in Case.xyz__c then it should add userid to the below list 

List<String> listUsersWithMatchingModel = new List<String>(); 
 
I need to help to pass account id from the CreateContactreateController.js to the createContact.apxc 

CreateContactreate.cmp
<aura:component controller="CreateContact" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="AccountId" type="String" />
    <aura:attribute name="CreateContact" type="Contact" default="{
                                                                 sObject : 'contact',
                                                                 LastName:'',
                                                                 AccountId:'',
                                                                 Email: '',
                                                                 Phone:''
                                                                 }" />
    <div class="slds-p-bottom_large slds-p-left_large" style="width:500px">
    <lightning:recordEditForm aura:id="recordEditForm"
                              recordId="{!v.recordId}"
                              objectApiName="Contact">
                    <lightning:inputField fieldName="LastName" aura:id="LastName" value="{!v.CreateContact.LastName}" />
                    <lightning:inputField fieldName="AccountId" aura:id="AccountId" value="{!v.CreateContact.AccountId}"/>
                    <lightning:inputField fieldName="Email" aura:id="Email" AccountIdvalue="{!v.CreateContact.Email}"/>
                    <lightning:inputField fieldName="Phone" aura:id="Phone" value="{!v.CreateContact.Phone}"/>
            <lightning:button aura:id="submit" type="submit" label="Save record" onclick="{!c.doSave}" class="slds-m-top_medium" />
        </lightning:recordEditForm>
    </div>
</aura:component>

CreateContactreateController.js
 
({
    doSave : function(component, event, helper) {
        var action = component.get('c.createContact');
        var contc = component.get('v.CreateContact').AccountId;
        console.log('AccountId '+ contc)
        action.setParams({
            con : component.get('v.CreateContact'),
            AccountId : contc
        })
        action.setCallback(this,function(response){
            var state = response.getState();
            alert(state);
            if(state === 'SUCCESS'|| state ==='DRAFT'){
                var responseValue = response.getReturnValue();
            }else if(state ==='INCOMPLETE'){
                
            }else if(state ==='ERROR'){
                var errors = response.getError();
                console.log('Error',errors)
                if(errors|| errors[0].message){
                    
                }
            }
            
        },'ALL');
        $A.enqueueAction(action);
	}
    
})

createContact.apxc
 
public class CreateContact {
    @AuraEnabled
    public static contact createContact(contact con,String AccountId) {
        system.debug('$$contact '+con+' $$Account Id'+AccountId);
        if (AccountId != null){
            //con.AccountId = AccountId;
            insert con;
          system.debug(' CON '+con);
        }
          return con;
    }
    
}

I am getting AccountId as null in apex controller and in console log i am getting following error. "Value provided is invalid for action parameter 'AccountId' of type 'String'"

Thanks in advnace  
I have created a page to where user can select the multiple contact from the search
but not not able to impliment save funtionality
Apex code: 
public class AccountContactProject {
    public Account accData{set;get;}{accData = new Account();}
    public String Name{get;set;}
    public Boolean MessageDetails{get;set;}{MessageDetails= false;}
    public Boolean ShowDetails{get;set;}{ShowDetails = false;}
    public List<Contact> conList{set;get;}
    Public List<MyWrapper> lisWrapper {get;set;}
    
    public void AccounteditPage(){
        Id IdValue = apexpages.currentpage().getparameters().get('id');
		accData = [select id,name,phone,Email__c,BillingStreet, BillingCity, BillingState, BillingPostalCode,
                   BillingCountry,account.Contact__c from Account where id=:IdValue];
    }
    
    public PageReference save(){
        if(accData.ID!=NULL){
            update accData;
        }else{
            insert accData;
        }

        return null;
    }
    
     public AccountContactProject(){
        lisWrapper = new List<MyWrapper>();
    }    
    
    public pageReference Search(){
        string tempInput = '%' + Name + '%';
        conList =[select id, name from Contact where name Like :tempInput ];
        if(conList!=null && !conList.isEmpty()){
           ShowDetails = true;
            MessageDetails = false;
            for(Contact con : conList){
      	lisWrapper.add(new MyWrapper(con,false));
          }
        }
         else{
        ShowDetails =false;
        MessageDetails = true;
        }
        return null;
    }
    
    public class MyWrapper{
        public contact conWrp{get;set;}
        public boolean checkBoxVal{get;set;}
        public MyWrapper(Contact conWrp, Boolean checkBoxVal){
            this.checkBoxVal = checkBoxVal;
            this.conWrp = conWrp;   
        }
    }
}

Vf Page:
 
<apex:page controller="AccountContactProject" showHeader="true">
    <apex:sectionHeader title="Account Edit" subtitle="New Account"/>
    <apex:form >
        <apex:pageBlock title="Account Edit">
            <apex:pageBlockButtons location="both">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Account Information" columns="2">
                <apex:inputField value="{!accData.name}" />
                <apex:inputField value="{!accData.phone}"/>
                <apex:inputfield value="{!accData.Email__c}"/>
                
                <!-- <apex:inputField value="{!accData.Country}"/> -->
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Account Address" >
                <apex:inputField value="{!accData.BillingStreet}"/>
                <apex:inputField value="{!accData.BillingCity}"/>
                <apex:inputField value="{!accData.BillingState}"/>
                <apex:inputField value="{!accData.BillingPostalCode}"/>
                <apex:inputField value="{!accData.BillingCountry}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Select Contact" >
                <apex:inputText label="Contact Search" value="{!Name}"/>  
                <apex:commandButton id="search" action="{!search}" value="Search"/>
                <apex:outputPanel id="NoData" rendered="{!MessageDetails}"><div>Data is not present in database</div> </apex:outputPanel>
                <apex:outputPanel id="WithData">
                    <apex:pageblock title="Contact Deatils" rendered="{!ShowDetails}" >
                        <apex:pageBlockTable value="{!lisWrapper}" var="wrpData">
                            <apex:column ><apex:inputCheckbox value="{!wrpData.checkBoxVal}"/></apex:column>
                            <apex:column value="{!wrpData.conWrp.name}"/>
                        </apex:pageBlockTable>
                    </apex:pageblock>
                </apex:outputPanel>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Thanks you.
 
Hi There,
can any one help me to write a trigger to update account phone number from the  recent created  contact or recent updated contact phone. 
the scenario should hold if there is multiple contact on account, updated uith the latest  created  contact phone or recent updated contact phone.
Hello,
I need help for the following trigger scenario:

There is one field in Account and one field in Opportunity 
Consider the field in Account is FieldA and the Field in the Opportunity is FieldB (consider both fields are check-box)
when i Update the fieldA in Account, the fieldB in Opportunity should get updated and
when i Update the fieldB in Opportunity, the fieldA in account should get Updated.

Thank you 
I need a help to write a trigger
can  any one help me how can i auto send a email to the Case Owner  whenever the case status is updated to closed through the trigger insted of process builder.

Thanks in advance.  
I need to help to pass account id from the CreateContactreateController.js to the createContact.apxc 

CreateContactreate.cmp
<aura:component controller="CreateContact" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="AccountId" type="String" />
    <aura:attribute name="CreateContact" type="Contact" default="{
                                                                 sObject : 'contact',
                                                                 LastName:'',
                                                                 AccountId:'',
                                                                 Email: '',
                                                                 Phone:''
                                                                 }" />
    <div class="slds-p-bottom_large slds-p-left_large" style="width:500px">
    <lightning:recordEditForm aura:id="recordEditForm"
                              recordId="{!v.recordId}"
                              objectApiName="Contact">
                    <lightning:inputField fieldName="LastName" aura:id="LastName" value="{!v.CreateContact.LastName}" />
                    <lightning:inputField fieldName="AccountId" aura:id="AccountId" value="{!v.CreateContact.AccountId}"/>
                    <lightning:inputField fieldName="Email" aura:id="Email" AccountIdvalue="{!v.CreateContact.Email}"/>
                    <lightning:inputField fieldName="Phone" aura:id="Phone" value="{!v.CreateContact.Phone}"/>
            <lightning:button aura:id="submit" type="submit" label="Save record" onclick="{!c.doSave}" class="slds-m-top_medium" />
        </lightning:recordEditForm>
    </div>
</aura:component>

CreateContactreateController.js
 
({
    doSave : function(component, event, helper) {
        var action = component.get('c.createContact');
        var contc = component.get('v.CreateContact').AccountId;
        console.log('AccountId '+ contc)
        action.setParams({
            con : component.get('v.CreateContact'),
            AccountId : contc
        })
        action.setCallback(this,function(response){
            var state = response.getState();
            alert(state);
            if(state === 'SUCCESS'|| state ==='DRAFT'){
                var responseValue = response.getReturnValue();
            }else if(state ==='INCOMPLETE'){
                
            }else if(state ==='ERROR'){
                var errors = response.getError();
                console.log('Error',errors)
                if(errors|| errors[0].message){
                    
                }
            }
            
        },'ALL');
        $A.enqueueAction(action);
	}
    
})

createContact.apxc
 
public class CreateContact {
    @AuraEnabled
    public static contact createContact(contact con,String AccountId) {
        system.debug('$$contact '+con+' $$Account Id'+AccountId);
        if (AccountId != null){
            //con.AccountId = AccountId;
            insert con;
          system.debug(' CON '+con);
        }
          return con;
    }
    
}

I am getting AccountId as null in apex controller and in console log i am getting following error. "Value provided is invalid for action parameter 'AccountId' of type 'String'"

Thanks in advnace  
I need a help to write a trigger
can  any one help me how can i auto send a email to the Case Owner  whenever the case status is updated to closed through the trigger insted of process builder.

Thanks in advance.