• Sami Shakith
  • NEWBIE
  • 345 Points
  • Member since 2015


  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 40
    Questions
  • 116
    Replies
Controller:
public class BankAccuont_TransactionStatus {
    public static void TransactionStatus(){
            List<Bank_Account__c> BankList = new List<Bank_Account__c>();
            List<Bank_Account__c> BList=[select id,Name,Account_Type__c,Number_Of_Transaction__c,Status__c from Bank_Account__c];
        for(Bank_Account__c b:BList){
            Bank_Account__c baccnt = new Bank_Account__c();
            if(b.Account_Type__c =='Current' && b.Number_Of_Transaction__c <=5){
                    baccnt.Status__c = 'Red';                  
                }
                else if(b.Account_Type__c=='Current' && b.Number_Of_Transaction__c == 6 || b.Number_Of_Transaction__c ==10){
                    baccnt.Status__c = 'Yellow';                    
                } 
            else if(b.Account_Type__c=='Current' && b.Number_Of_Transaction__c >= 10){
                    baccnt.Status__c = 'Green';
            }
            BankList.add(baccnt);            
        }
      // update BankList;
                
    }
}
=====================================================
trigger:
trigger Update_Status_Based_On_Transactions on Bank_Account__c (after insert,after update) {
    
    BankAccuont_TransactionStatus.TransactionStatus(trigger.new);
}
Hi!
I have a master detail relationsip between Installation__c and Account. and ralation field between Installation__c  & Account is Site__c(API name).
I have a picklist (Time Zone) value on Account and Installation__c that are identical.
There are 5 values for the picklist.

Whenever the picklist value changes on Installation__c , I want to update the picklist value on Account  by using apex code only. But i'm getting null value at  insert accountstoUpdate; line.
Can anyone help, thanks in advance.

My apex class:
public class AccountTimeZoneUpdate {
       public static void accountTimeZone(List<Installation__c> newlist){ 
         set<Id> insId = new set<Id>();
        for(Installation__c inst : newList){
            insId.add(inst.id); 
        } 
     List<Installation__c> instList = [select id,Time_Zone__c Name from Installation__c];
          system.debug('installation list:'+instList);
           
           List<Account> accList = [select id,Time_Zone__c,name from  Account where Time_Zone__c =: null];
           
               system.debug('installation list:'+instList);
           List<Account> accountstoUpdate = new List<Account>();
          
           for(Installation__c insVar:instList){
               for(Account a: accList){
         //  Account acc = new Account();
              if(insVar.Time_Zone__c != null && insVar.Time_Zone__c != '') {
                   a.Time_Zone__c = insVar.Time_Zone__c;
                   accountstoUpdate.add(a);
              }
         }  
     }
            insert accountstoUpdate;
           system.debug('accountstoUpdate time:'+accountstoUpdate);
  }
}

My trigger:
trigger InstallationTrigger on Installation__c (after insert, after update) {
       if (Trigger.isAfter && (Trigger.isInsert || Trigger.isUpdate)){
            AccountTimeZoneUpdate.accountTimeZone(trigger.new);
        }
    
  • February 26, 2019
  • Like
  • 0
Hi, 
 So I have an input field :<b>To: </b> <apex:inputfield value="{!q.contactid}"/><p/>

and in my controller, I have:
public Quote q {get;set;}

and then I would like to present the email address in this outputfield: <b>NAME: </b> <apex:outputtext value="{!q.contact.name}"/><p/> 

However this is not working, Please help: 
Below is my VF page: 
<apex:page standardController="Quote" extensions="email_class">
    <apex:form >
        <apex:pageBlock title="Email Details" id="ed">
            <b>To: </b> <apex:inputfield value="{!q.contactid}"/><p/>
         <apex:actionSupport event="onchange"  action="{!Contactpopulated}" rerender="ed"/>      
               <b>NAME: </b> <apex:outputtext value="{!q.contact.email}"/><p/> 
.......
.......

and my extension:
public class email_class{
        
    Public string ToAddresses {get;set;}
    Public string CCAddresses {get;set;}
    Public string quoteId {get;set;}
    Public string subject {get;set;}
    public string email_body {get;set;}
    public string emailTo {get;set;}
    public string emailCC {get;set;}
   public Quote q {get;set;}
   // public Contact ct {get;set;}
     public  string [] ccaddress; 
       
        public email_class(ApexPages.StandardController controller) {
                quoteId = ApexPages.currentPage().getParameters().get('id');
              Quote  q= (Quote)controller.getRecord();
    }

             public void Contactpopulated(){
       q.contact=[ Select  email, name From contact where  id=:q.contactid limit 1]; 
}


 
  • March 09, 2017
  • Like
  • 0
Dear All, plz suggest.
I have a look up field to Account object,
User-added image
when i click on NEW button, i have a specific input fields showing, i want to modify the input fields, i am not getting where these has been maintained and from where can i change aand add/delete the page fields. Thnx
User-added image
Hello,
  I have created custom button to choose city and then to select records according to city. I want to validate "show selected" button so that it will show alert if we do not select any records and try to move further. plz see my code

Controller:

public with sharing class MyCompController3

public  id tid{get;set;}
public String str;
public String city{get;set;}
    public MyCompController3(ApexPages.StandardController controller)
     {
 
     }
    
    public pagereference dosome(){
    
wrapAccountList = new List<wrapAccount>();
for(Account a: [select Id, RecordType.Name, Name, City__c from Account where City__c =:city ORDER BY RecordType.Name DESC])
{
wrapAccountList.add(new wrapAccount(a));
system.debug('*****************wrapAccountList******************'+wrapAccountList);
}

    return null;
    }

public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('--None--','--None--'));
            options.add(new SelectOption('Ahmednagar','Ahmednagar'));
            options.add(new SelectOption('Akola','Akola'));
            options.add(new SelectOption('Amravati','Amravati'));
            options.add(new SelectOption('Aurangabad','Aurangabad'));
            options.add(new SelectOption('Bhiwandi','Bhiwandi'));
            options.add(new SelectOption('Chandrapur','Chandrapur'));
            options.add(new SelectOption('Chinchwad','Chinchwad'));
            options.add(new SelectOption('Dhule','Dhule'));
            options.add(new SelectOption('Dombivali','Dombivali'));
            options.add(new SelectOption('Jalgaon','Jalgaon'));
            options.add(new SelectOption('Kalyan','Kalyan'));
            options.add(new SelectOption('Kolhapur','Kolhapur'));
            options.add(new SelectOption('Latur','Latur'));
            options.add(new SelectOption('Malegaon','Malegaon'));
            options.add(new SelectOption('Mumbai','Mumbai'));
            options.add(new SelectOption('Nagpur','Nagpur'));
            options.add(new SelectOption('Nanded','Nanded'));
            options.add(new SelectOption('Nashik','Nashik'));
            options.add(new SelectOption('Navi Mumbai','Navi Mumbai'));
            options.add(new SelectOption('Parbhani','Parbhani'));
            options.add(new SelectOption('Pimpri','Pimpri'));
            options.add(new SelectOption('Pune','Pune'));
            options.add(new SelectOption('Sangli','Sangli'));
            options.add(new SelectOption('Satara','Satara'));
            options.add(new SelectOption('Solapur','Solapur'));
            options.add(new SelectOption('Thane','Thane'));
            options.add(new SelectOption('Vasai','Vasai'));
            options.add(new SelectOption('Virar','Virar'));

            return options;
        }


public List<wrapAccount> wrapAccountList {get; set;}
public List<Account> selectedAccount{get;set;}

private List<Id> accountids=new list<Id>();
public List<Account> acc;

public PageReference processSelected()
{
    selectedAccount = new List<Account>();

    for(wrapAccount wrapAccountObj : wrapAccountList)
    {
    if(wrapAccountObj.selected == true)
    {
        selectedAccount.add(wrapAccountObj.acc);
        //accWrap.acc.Name
        system.debug('*****************!!!!!!!!!wrapAccountList******************'+selectedAccount);

    }
    }
             PageReference pageRef = new PageReference('/apex/Visitplan');
             return pageRef;
            
}

public list<Account> srecs;
public list<Account> getSrecs()
{


 
 srecs= [select Id, Name, RecordType.Name, City__c from Account];
 system.debug('*****************!!!!!!!!!srecssrecssrecssrecs******************'+srecs);
 tid = ApexPages.currentPage().getParameters().get('id');
 system.debug('*****************!!!!!!!!!$$$$$$$$$$$$$$$$$$$$$$$$$******************'+tid);

        return selectedAccount;
}
public PageReference CreateRec()
{
for(Account  acr :selectedAccount)
{
Planned_Visit__c pv =new Planned_Visit__c();
pv.Daily_Visit_Plan__c= tid;
pv.Name__c=acr.id;
insert pv;
ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.CONFIRM,'Successfully Inserted Visit.'));

}
             return null;
}

public class wrapAccount {
public Account acc {get; set;}
public Boolean selected {get; set;}

public wrapAccount(Account a)
 {
acc = a;
selected = false;
}
}
}


VF PAGE:
<apex:page standardController="Daily_Visit_Plan__c" extensions="MyCompController3" standardStylesheets="false" sidebar="false">
 <style type="text/css">


.myButton {
    -moz-box-shadow: 3px -3px 5px -2px #899599;
    -webkit-box-shadow: 3px -3px 5px -2px #899599;
    box-shadow: 3px -3px 5px -2px #899599;
    background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #bab1ba));
    background:-moz-linear-gradient(top, #ededed 5%, #bab1ba 100%);
    background:-webkit-linear-gradient(top, #ededed 5%, #bab1ba 100%);
    background:-o-linear-gradient(top, #ededed 5%, #bab1ba 100%);
    background:-ms-linear-gradient(top, #ededed 5%, #bab1ba 100%);
    background:linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#bab1ba',GradientType=0);
    background-color:#ededed !Important;
    -moz-border-radius:24px !Important;
    -webkit-border-radius:24px !Important;
    border-radius:24px !Important;
    border:2px solid #d6bcd6 !Important;
    display:inline-block !Important;
    cursor:pointer !Important;
    color:#3a8a9e !Important;
    font-family:Arial !Important;
    font-size:18px !Important;
    font-weight:bold !Important;
    padding:2px 36px !Important;
    text-decoration:none !Important;
    text-shadow:0px 0px 0px #e1e2ed !Important;
}
.myButton:hover {
    background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #bab1ba), color-stop(1, #ededed));
    background:-moz-linear-gradient(top, #bab1ba 5%, #ededed 100%);
    background:-webkit-linear-gradient(top, #bab1ba 5%, #ededed 100%);
    background:-o-linear-gradient(top, #bab1ba 5%, #ededed 100%);
    background:-ms-linear-gradient(top, #bab1ba 5%, #ededed 100%);
    background:linear-gradient(to bottom, #bab1ba 5%, #ededed 100%);
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bab1ba', endColorstr='#ededed',GradientType=0);
    background-color:#bab1ba;
}
.myButton:active {
    position:relative;
    top:1px;
}

 
 

</style>
<script type="text/javascript">
function selectAllCheckboxes(obj,receivedInputID)
{
var inputCheckBox = document.getElementsByTagName("input"); for(var i=0; i<inputCheckBox.length; i++)
{
if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1)
{
inputCheckBox[i].checked = obj.checked;
} } }
</script>


    
<apex:form >
<center>
<apex:commandButton styleClass="myButton" value="Show Selected" action="{!processSelected}" />
<br />
<br />
<br />

<apex:actionRegion >
<h1> Choose City </h1>
<apex:selectList style="float: center; width: 250px; height: 40px; margin: 10px;  background-color:#ededed;
    border-radius:24px !Important;
    border:2px solid #d6bcd6 !Important;
    display:inline-block !Important;
    cursor:pointer !Important;
    color:#3a8a9e !Important;
    font-family:Arial !Important;
    font-size:18px !Important;
    font-weight:bold !Important;
    padding:2px 36px !Important;
    text-decoration:none !Important;
    text-shadow:0px 0px 0px #e1e2ed !Important; cursor:pointer"  value="{!city}" size="1">
<apex:selectOptions value="{!items}"/>
<apex:actionSupport event="onchange" action="{!dosome}"  reRender="table" />
</apex:selectList>
</apex:actionRegion>
 <br />
<br />
<br />
       
<apex:pageBlock >
<apex:pageblockSection title="All Doctors And Chemists" collapsible="false" columns="1">
<apex:pageBlockTable value="{!wrapAccountList}" var="accWrap" title="All Doctors And Chemists" id="table">
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
</apex:facet>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
</apex:column>
<apex:column value="{!accWrap.acc.Name}" />
<apex:column value="{!accWrap.acc.City__c}" />
<apex:column value="{!accWrap.acc.RecordType.Name}" />
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>
<br />
<br />
<br />
<apex:commandButton styleClass="myButton" value="Show Selected" action="{!processSelected}" />
</center>

</apex:form>
</apex:page>
Hi All

Im doing Aura Components Specialist Superbadge. Im not able to see the boat in my page. Im new to aura components.

Please look at the code and suggest me.

BoatSearchResults.cmp
<aura:component controller="BoatSearchResults" Implements="flexipage:availableForAllPageTypes">
    <aura:attribute name="boats" type="Boat__c[]"/> 
    <aura:method name="search" action="{!c.search}">
        <aura:attribute name="boatTypeId" type="String"/>
    </aura:method>
    <aura:attribute name="boatTypeId" type="String"/>
    <div class='slds-m-around_medium'>
        <lightning:layout horizontalAlign="center" verticalAlign="center" multipleRows='true'>

            <aura:if isTrue="{!v.boats.length > 0}">
                <aura:iteration items="{!v.boats}" var="bot">
                    <lightning:layoutItem flexibility="grow" class="slds-m-around_small">
                        <c:BoatTile boat="{!bot}" />
                    </lightning:layoutItem>
                </aura:iteration>
                <aura:set attribute="else">
                    <lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">
                        <ui:outputText value="No boats found" />
                    </lightning:layoutItem>
                </aura:set>
            </aura:if> 
        </lightning:layout>
    </div>
</aura:component>
BoatSearchResultsController.js
({
    search: function(component, event, helper){ 
        var params = event.getParam('arguments'); 
        var arg = component.get('c.doSearch');
        $A.enqueueAction(arg); 
    }, 
    doSearch : function (component, event, helper){ 
        helper.onSearch(component); 
    },
})
BoatSearchResultsHelper.js
({
    onSearch : function(component, event) {
        var boatTypId = component.get("v.boatTypeId");
        alert(boatTypId);
        var action = component.get("c.getBoats");
        action.setParams({boatTypeId:boatTypId});

        action.setCallback(this, function(response){
            var state = response.getState();
            if(state === "SUCCESS"){
                var res = response.getReturnValue();
                component.set("v.boats", res);
            }
            else{
                console.log("Failed with state: " + state);   
            }
        });

        $A.enqueueAction(action);
    },
})

Thanks in advance
Sameena S
Hello everyone,

View setup, edit setup, delete setup are basically present on system administrator profile.User-added image
I want the same for custome profile. Below image is from custom profile (not cloned from system adminisrator)
User-added image
How can i achieve that?  Please anyone help me on this. Thanks in advance.
Hi all,

Consider i have one object named as obj1 and have self-lookup within that. So record of obj1 can have multiple child records of the obj1(same object). Now i want to update child records when parent getting updated. How can i face this scenario? Please suggest any ideas.
Hi all,

In my org i have "My email settings" footer and "Email Footer". While sending emails to user I dont want to show these email footers for some templates. How can i achive it?
Hi,

I want to get email template as a field in custom object(using lookup relationship). Is it possible? If it is how can i?
Hi,

I want to find the day of paticular date e.g if my date is 28-jun-16 then my formula field should be written as thursday. How can i achieve this? please give me some suggestions.
Hi, 

I want to show only custom error messages and dont want to show the exception while saving my Record using VF page

Here is my controller
public class Sample 
{
    public String nam {get;set;}
    public Decimal age {get;set;} 
    public string email{get;set;}

    public pageReference submit()
    {
    pageReference p;
        try
        {
            Account m = new Account();
            m.Name = nam;
            m.Age__c = age;
            m.Account_email__c=email;
            insert m;
            p=new pageReference('/'+m.id);
            return p;
        }
        catch(Exception e)
        {
        If(Nam==null){
              ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,'Name Should not be null');
              ApexPages.addMessage(msg);
         }            
         if(Age==0){
               ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,'Age should not be null');
               ApexPages.addMessage(msg);
         }
         if(email==null){
               ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,'email should not be null');
               ApexPages.addMessage(msg);
         }
        return null;    

        }
    }

}
Here is my VF page
<apex:page controller="Sample" sidebar="false" >
<apex:pagemessages />
<apex:form >
    <apex:pageblock >      
        <apex:pageBlocksection >
            <apex:pageblockSectionItem ><apex:outputLabel>Name</apex:outputLabel><apex:inputtext value="{!nam}" /></apex:pageblockSectionItem>          
            <apex:pageblockSectionItem ><apex:outputLabel>Email</apex:outputLabel><apex:inputtext value="{!email}" /></apex:pageblockSectionItem>
            <apex:pageblockSectionItem ><apex:outputLabel>Age</apex:outputLabel><apex:inputtext value="{!age}" /></apex:pageblockSectionItem>         
        </apex:pageBlocksection>        
        <apex:pageblockButtons >
            <apex:commandButton value="Submit" action="{!submit}" reRender=""/>
        </apex:pageblockButtons>
    </apex:pageblock>
</apex:form>
</apex:page>

It showing error msg like as below
User-added image

I want to display like
Name Should not be null
Age Should not be null
email Should not be null

How can i achieve this? can someone help me?
 
Hi all,

I need to download a document in specified distination. How can i achive this? Please anyone help me.
Hi experts,

I want to create a popup window that pops up when a new lead remains in the same status for some period of time and also I want the pop up to follow the user around Salesforce until they move the new lead out of the New status. Please anyone give some idea to implement this.

Thanks in advance.
Hi,

I want to send a mail with attachment which is in word format using email template. renderAs attribute is only works for PDF. Please anyone tell some suggestion.

Thanks in advance.
Hi all,

I have created some custom label and used insed the Email template using VF page. Custom label is shown inside the body of the mail. But it showing values inside the attachment. Here is my code. Please some help me.
 
<messaging:emailTemplate subject="Opportunity Created" recipientType="User" relatedToType="Opportunity" language="{!CASE(relatedTo.ChooseCountry__c,'German','DE','English','EN','French','FR','Italian','IT','Danish','da','Spanish','es','Dutch','nl','Finnish','fi','Portuguese','pt','Swedish','sv','Polish','pl','Norweigian','no','Chinese (Simplified)','zh_CN','Chinese (Traditional)','zh_TW','Dutch','nl_NL','Finnish','fr','Japanese','ja','Korean','ko','Portuguese (Brazil)','pt_BR','Russian','ru','Thai','th','EN')}">
<messaging:HtmlEmailBody >
Congratulations {!relatedTo.Name} ! <br/><br/>
------------------------------------------------------------------------------<br/>
Your Opportunity has been created with following details!<br/>
------------------------------------------------------------------------------<br/><br/>

<table border="0" >
    <tr><td>{!$label.Opportunity_Name}</td><td>{!relatedTo.Name}</td></tr>
    <tr><td>{!$label.Account_Name}</td><td>{!relatedTo.Account.Name}</td></tr>
    <tr><td>{!$label.Stage_Name}</td><td>{!relatedTo.StageName}</td></tr>
    <tr><td>{!$label.Close_Date}</td><td>{!relatedTo.CloseDate}</td></tr></table>

</messaging:HtmlEmailBody>

<messaging:attachment renderAs="PDF">
<html>
<body>
<apex:outputText value="{!$Label.Greeting}" style="font-weight:bold"/><br/><br/>
    {!$label.Greeting}&nbsp;{!relatedTo.Name}!<br/>
    <table border="0" >
    <tr><td>{!$label.Opportunity_Name}</td><td>{!relatedTo.Name}</td></tr>
    <tr><td>{!$label.Account_Name}</td><td>{!relatedTo.Account.Name}</td></tr>
    <tr><td>{!$label.Stage_Name}</td><td>{!relatedTo.StageName}</td></tr>
    <tr><td>{!$label.Close_Date}</td><td>{!relatedTo.CloseDate}</td></tr></table>
</body>
</html>    
</messaging:attachment>
</messaging:emailTemplate>

 
Hi all,

I need to send email based on the country language of the user. For example if the user choose india, Email body will be in hindi. If user choose Korea the body will be in korean language. Suggestion please.

Thank You,
 
 
Hi all,

Please anyone tell me how to change the Site URL of developer account?

Thanks.
 
Hi,

I want to display values on vf page which is stored in list. I have used <apex:datatable> to display those values. But it is not displaying any values on vf page.In that list contains json deserialized response.I am getting the response, i'm able get the individual values also. It shows in the debug logs, but not displaying in the vf page. 
<apex:page Controller="CanvasController" action="{!requestM}" sidebar="false">
<!--{!response}-->    

<apex:pageBlock>
<apex:pageblockSection >
    <apex:dataTable value="{!dr}" var="d">
        <apex:column headerValue="Item id"><apex:outputText value="{!d.ItemId}"/></apex:column>
        <apex:column headerValue="Name"><apex:outputText value="{!d.name}"/></apex:column>
        <apex:column headerValue="upc"><apex:outputText value="{!d.Upc}"/></apex:column>
     </apex:dataTable>
    </apex:pageblockSection>
</apex:pageBlock>
  
</apex:page>
 
global class CanvasController{

public Integer ItemId{get;set;}
public String name{get;set;}
public List<Items> dr{get;set;}

public CanvasController(){

}

public void requestM(){

    String url = 'http://api.walmartlabs.com/v1/feeds/specialbuy?apikey=5amzkrmy235zddjwmu785hf8&categoryId=3944';

    HttpRequest req = new HttpRequest();
    req.setEndpoint(url);
    req.setMethod('GET');

    Http http = new Http();
    HttpResponse res = http.send(req);
    String responseBody = res.getBody();
    system.debug('statuscode: ' + res.getStatusCode());
    
    //system.debug('Response : ' + responseBody);
    ResCls resItem = (ResCls)JSON.deserialize(responseBody, ResCls.class);
    system.debug('Response after deserialization: ' + resItem);
    system.debug('Response Items: ' + resItem.items);
    List<Items> rl = resItem.items;
    List<Items> dr = new List<Items>();
    for(Items it:rl){
        system.debug('Item Name: ' + it);
        ItemId = it.ItemId;
        name = it.Name;
        system.debug('ItemId: ' + it.ItemId);
        system.debug('Name: ' + it.Name);
        dr.add(it);
    }   
   system.debug('List: ' + dr);
}

public class ResCls{
    List<Items> items;
}
    
public class Items{

public Integer ItemId{get;set;}
public Integer ParentItemId{get;set;}
public String Name{get;set;}
public Double SalePrice{get;set;}
public String Upc{get;set;}
public String CategoryPath{get;set;}
public Boolean AvailableOnline{get;set;}
public String ShortDescription{get;set;}
public String LongDescription{get;set;}
public String BrandName{get;set;}
public String ThumbnailImage{get;set;}
public String LargeImage{get;set;}
public String ProductTrackingUrl{get;set;}
public Boolean FreeShipping{get;set;}
public Boolean NinetySevenCentShipping{get;set;}
public Double StandardShipRate{get;set;}
public Double TwoThreeDayShippingRate{get;set;}
public Double OvernightShippingRate{get;set;}
public String Size{get;set;}
public String Color{get;set;}
public Boolean Marketplace{get;set;}
public Boolean ShipToStore{get;set;}
public Boolean FreeShipToStore{get;set;}
public String ModelNumber{get;set;}
public String SellerInfo{get;set;}
public String ProductUrl{get;set;}
public List<Integer> Variants{get;set;}
public List<String> Shelves{get;set;}
public String CustomerRating{get;set;}
public String CustomerRatingImage{get;set;}
public Integer NumReviews{get;set;}
//public Item.BestMarketPlacePrice BestMarketplacePrice{get;set;}
public String CategoryNode{get;set;}
public Boolean isRollBack{get;set;}
public Boolean isSpecialBuy{get;set;}
public String Isbn{get;set;}
public Boolean Bundle{get;set;}
public Boolean Clearance{get;set;}
public Boolean PreOrder{get;set;}
public String PreOrderShipsOn{get;set;}
public String Stoc{get;set;}
public Boolean Freight{get;set;}
public Long DealEndTime{get;set;}
public Long DealStartTime{get;set;}
//public Item.Attributes Attributes{get;set;}
public String Gender{get;set;}
public String Age{get;set;}
}


}

  
Hi,

I am trying to develop S2S integration using canvas application. For that i followed http://www.jitendrazaa.com/blog/salesforce/salesforce-to-salesforce-integration-using-canvas/ In that he asked to develop a VF(in service provider) which will be called in identity provider. 

VF code is as below
<apex:page showHeader="false">
    
    <script type="text/javascript" src="{!URLFOR($Resource.CanvasSDK,'SalesforceCanvasJavascriptSDK-master/js/canvas-all.js')}" />
    
    <script type="text/javascript">
        
        var sid="{!GETSESSIONID()}".substr(1,30) +'...';
    
    	function refreshSR(){
        	Sfdc.canvas.client.refreshSignedRequest(function(data){
            	
                if(data.status == 200){
                	var signedRequest = data.payload.response;
                    var part = signedRequest.split('.')[1];
                    var obj = JSON.parse(Sfdc.canvas.decode(part));
                    updateDisplay(obj) ;
                } 
            }); 
        }
    
    function updateDisplay(obj){
    	setValue('spSessionId', sid);
        setValue('ipOAuth', obj.client.oauthToken.substr(1,30)+'...');
        setValue('ipUser', obj.context.user.fullName);
        setValue('ipOrg', obj.context.organization.name);
        setValue('ipRefresh', obj.client.refreshToken.substr(1,30)+'...');
    }
    
    function setValue(eleId,val)
    {
       	var domEl = document.getElementById(eleId);
        if(domEl){
        	domEl.innerHTML = val;    
        }
    }
    
    Sfdc.canvas.onReady(function(){
    	refreshSR();
    });
         
    </script>
          
        <b> <u> Service Provider Org </u></b>  
        I am Canvas App from Salesforce Domain <b> Jitendra.zaa5@gmail.com </b>      
        User : {!$User.FirstName} {!$User.LastName} 
        Org : {!$Organization.Name}
        Session Id : <span id="spSessionId"></span>    

<hr />
 
        <b> <u> Identity Provider Org  - Current Org </u> </b>
        User : <span id="ipUser"></span>
         Org : <span id="ipOrg"></span>
         OAUth Token : <span id="ipOAuth"></span>
        Refresh Token : <span id="ipRefresh"></span>
     
</apex:page>

My VF page showing without the session id and informations of identity provider in identity provider entity as below
User-added image

How to get those values. I Need some one help to resolve it. 

Thanks.
 
Hi,

I am trying to develop S2S integration using canvas application. For that i followed http://www.jitendrazaa.com/blog/salesforce/salesforce-to-salesforce-integration-using-canvas/ In that he asked to develop a VF(in service provider) which will be called in identity provider. 

VF code is as below
<apex:page showHeader="false">
    
    <script type="text/javascript" src="{!URLFOR($Resource.CanvasSDK,'SalesforceCanvasJavascriptSDK-master/js/canvas-all.js')}" />
    
    <script type="text/javascript">
        
        var sid="{!GETSESSIONID()}".substr(1,30) +'...';
    
    	function refreshSR(){
        	Sfdc.canvas.client.refreshSignedRequest(function(data){
            	
                if(data.status == 200){
                	var signedRequest = data.payload.response;
                    var part = signedRequest.split('.')[1];
                    var obj = JSON.parse(Sfdc.canvas.decode(part));
                    updateDisplay(obj) ;
                } 
            }); 
        }
    
    function updateDisplay(obj){
    	setValue('spSessionId', sid);
        setValue('ipOAuth', obj.client.oauthToken.substr(1,30)+'...');
        setValue('ipUser', obj.context.user.fullName);
        setValue('ipOrg', obj.context.organization.name);
        setValue('ipRefresh', obj.client.refreshToken.substr(1,30)+'...');
    }
    
    function setValue(eleId,val)
    {
       	var domEl = document.getElementById(eleId);
        if(domEl){
        	domEl.innerHTML = val;    
        }
    }
    
    Sfdc.canvas.onReady(function(){
    	refreshSR();
    });
         
    </script>
          
        <b> <u> Service Provider Org </u></b>  
        I am Canvas App from Salesforce Domain <b> Jitendra.zaa5@gmail.com </b>      
        User : {!$User.FirstName} {!$User.LastName} 
        Org : {!$Organization.Name}
        Session Id : <span id="spSessionId"></span>    

<hr />
 
        <b> <u> Identity Provider Org  - Current Org </u> </b>
        User : <span id="ipUser"></span>
         Org : <span id="ipOrg"></span>
         OAUth Token : <span id="ipOAuth"></span>
        Refresh Token : <span id="ipRefresh"></span>
     
</apex:page>
My VF page showing without the session id and informations of identity provider as belowUser-added image
How to get those values. I Need some one help to resolve it. 

Thanks.
Hi,

Please anybody help me to integrate 3rd party application with salesforce. I have gone through the integration using heroku workbook(https://developer.salesforce.com/docs/atlas.en-us.integration_workbook.meta/integration_workbook/integration3a_2.htm). But it throws some exception. I couldn't find proper solution. So please someone guide me.
Hi,

I am trying to create a VF page which calculates the NetAmount based on Buying Price and Discount in listed record. 

My VF page is 
 
<apex:page StandardController="Opportunity" extensions="EQuoteController">
  <apex:form > 
      <apex:pageBlock >
          <apex:pageBlockSection columns="1">
              <apex:outputField label="User Name" value="{!opportunity.Name}"/>
              <apex:outputField label=" Account Name" value="{!Opportunity.AccountId}"/>
              <apex:outputField label="Email Id" value="{!Opportunity.Email__c}"/>
              <apex:outputText Label="Net Amount" Value="{!NetAmount}"/>
          </apex:pageBlockSection>
          
           Related price details for {!Opportunity.name}:    
          <apex:pageblockSection title="Price Details" collapsible="false" columns="2">
                <apex:pageBlockTable value="{!selectedlist}" var="price" id="table2" title="Selected Price Details">
                             
                   <apex:column value="{!price.Name}" headerValue="Name"/>
                   <apex:column value="{!price.Buying_Price__c}" headerValue="Buying Price"/>
                   <apex:column headerValue="Discount">
                   <apex:inputText value="{!Discount}"/>
                   </apex:column>
                   <apex:column headerValue="Action">
                   <apex:commandButton value="ok" action="{!OkDiscount}"/>
                   </apex:column>
                </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
         
          
</apex:page>

Ok button method is like that
 
public void OkDiscount(){
price = new price_details__c();
    DisAmount=0;
    NetAmount=0;
    selectedList = new List<Price_Details__c>();
    for(wrapPrice wrapPriceObj : wrapPriceList) {
            if(wrapPriceObj.selected == true) {
            selectedList.add(wrapPriceObj.pds);
            pid=wrapPriceObj.pds.id;
            price=[select id, name, Buying_price__c from Price_details__c where id=:pid];
            NetAmount=NetAmount+price.Buying_price__c;
            DisAmount=(Discount*price.Buying_price__c)/100;
            NetAmount=NetAmount-DisAmount;
            }
    }
}

I am using Wrapper class for list the records.
That VF page will display the details of the opportunity and Net amount for the listed record below. I gave PageBlockTable for getting records and also I include a textfield to get discount amount. Here i gave single variable for the textfield. If only one record is listed means it works fine. But for multiple records it will take only the last value for Net amount calculation. I am getting multiple values using single variable name. I dont know how to get the multiple variables. I need someone help. Suggestion please.
Hi,

I am trying to create VF page it displays a report based on month and year. If i give month and year for generated report its showing the result. For other it should show the error messege. 

Here is my VF page code
 
<apex:page controller="test" sidebar="false" >

<apex:form ID="Search" >  
<b>Enter Search parameters</b>
<apex:pageBlock >  
 <apex:pageMessages></apex:pageMessages> 
<apex:pageBlockButtons >
<apex:commandButton value="Submit" action="{!Search}" reRender="showpartner" />
</apex:pageBlockButtons>  <apex:outputLabel title="Enter Search Parameters" value="Enter Year(Exp: 2015 or 2016...):" style="font:bold" /> 
<apex:inputText value="{!Name}"/><br/><br/>
 <apex:outputLabel value="Enter Month(Exp: July or August..):" /> 
<apex:inputText value="{!Month}"/>
<apex:pageBlockTable value="{!tenpartners }" var="partnervalue" id="showpartner" > 

   <apex:column > <b>Search Results</b> <analytics:reportChart reportid="00O280000035HWm" 
  filter="{column:'Opportunity.syear__c', operator:'equals', value:'{!JSENCODE(partnervalue.syear__c)}'},{column:'Opportunity.smonth__c', operator:'equals', value:'{!JSENCODE(partnervalue.smonth__c)}'}"> 
 
</analytics:reportChart></apex:column>   </apex:pageblockTable>    </apex:pageBlock>  </apex:form></apex:page>

Here is my class
 
public class test{
Public List<opportunity> tenpartners{get;set;}
public string Name{get;set;}
public string Month{get;set;}
public Boolean rend { get; set; }
public pagereference search(){
tenpartners = new List<opportunity>();
//tenpartners = database.query('SELECT syear__c FROM Opportunity where syear__c=:Name LIMIT 1');
tenpartners = database.query('SELECT ID,smonth__c,syear__c,Name FROM opportunity where syear__c=:Name and smonth__c=:Month limit 1');
system.debug('tenpartners!!!!'+tenpartners);

if(tenpartners.size() ==0 )
{
 system.debug('tenpartners!!!!'+tenpartners);

    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please enter the correct value.');
ApexPages.addMessage(myMsg);
           
}
return null;}
}

Please i need some one help.
 
Hi,

I am trying to filtering records using wrapper class from one VF page to another page.

here is VF page code
<apex:page standardController="Account" extensions="AccountSelectClassController" sidebar="false">
    <script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckBox.length; i++){
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                    inputCheckBox[i].checked = obj.checked;
                }
            }
        }
    </script>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Show Selected Accounts" action="{!processSelected}" rerender="table2"/>
            </apex:pageBlockButtons>
 
            <apex:pageblockSection title="All Accounts" collapsible="false" columns="1">
 
                <apex:pageBlockTable value="{!wrapAccountList}" var="accWrap" id="table" title="All Accounts">
                    <apex:column >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        </apex:facet>
                            <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                    </apex:column>
                    <apex:column value="{!accWrap.acc.Name}" />
                    <apex:column value="{!accWrap.acc.BillingState}" />
                    <apex:column value="{!accWrap.acc.Phone}" />
                </apex:pageBlockTable>
 
            </apex:pageblockSection>
        </apex:pageBlock>
    </apex:form>
 
</apex:page>

Below is my second VF page
 
<apex:page standardController="Account" extensions="AccountSelectClassController">
  <apex:form >
      <apex:pageBlock >
       <apex:pageBlockTable value="{!selectedAccounts}" var="c" id="table2" title="Selected Accounts">
                   
                   <apex:column value="{!c.Name}" headerValue="Account Name"/>
                   <apex:column value="{!c.BillingState}" headerValue="Billing State"/>
                   <apex:column value="{!c.Phone}" headerValue="Phone"/>
                </apex:pageBlockTable>
      </apex:pageBlock>
  </apex:form>
</apex:page>

Here is Controller Class
 
public class AccountSelectClassController{
 
    //Our collection of the class/wrapper objects wrapAccount
    public List<wrapAccount> wrapAccountList {get; set;}
    public List<Account> selectedAccounts{get;set;}
 
    public AccountSelectClassController(ApexPages.StandardController controller){
        if(wrapAccountList == null) {
            wrapAccountList = new List<wrapAccount>();
            for(Account a: [select Id, Name,BillingState, Website, Phone from Account limit 10]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapAccountList.add(new wrapAccount(a));
            }
        }
    }
 
    public pageReference processSelected() {
    selectedAccounts = new List<Account>();
 
        for(wrapAccount wrapAccountObj : wrapAccountList) {
            if(wrapAccountObj.selected == true) {
                selectedAccounts.add(wrapAccountObj.acc);
            }
        }
         pagereference ref;
     ref = new pagereference('/apex/AccountSelectedWrapper');
     ref.setredirect(true);
     return ref;
    }
 
    // This is our wrapper/container class. In this example a wrapper class contains both the standard salesforce object Account and a Boolean value
    public class wrapAccount {
        public Account acc {get; set;}
        public Boolean selected {get; set;}
 
        public wrapAccount(Account a) {
            acc = a;
            selected = false;
        }
    }
}

If give the second VF page function in 1st VF page its working fine. But displaying that filter record in another page means its showing none records. Simply displaying header alone. Please i need someone help.

Hi - 
 

I have a Mass Create Button that I'm trying to get functionality to work on but it doesn't seem to be going to plan. Can someone assist?
 

I'm trying to get multiple rows to be created when I click on the "Add Assignment Row" button, but it just refreshes the page and shows a single row again (see button and row below). 
User-added image
This is my current VF Page:

<apex:page standardController="pse__Assignment__c" recordSetVar="unused" extensions="AddanotherAssignmentController" >
<apex:enhancedList type="pse__Assignment__c" height="300" rowsPerPage="10" id="ListViewID"/>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!listAssignment}" var="TC">
                <apex:column headerValue="Assignment Name">
                    <apex:inputField value="{!TC.Name}"/>
                </apex:column>
                <apex:column headerValue="Resource">
                    <apex:inputField value="{!TC.pse__Resource__c}"/>
                </apex:column>
                <apex:column headerValue="Project">
                    <apex:inputField value="{!TC.pse__Project__c}"/>
                </apex:column>
                <apex:column headerValue="Candidate">
                    <apex:inputField value="{!TC.Candidate__c}"/>
                </apex:column>
                <apex:column headerValue="Bill Rate">
                    <apex:inputField value="{!TC.pse__Bill_Rate__c}"/>
                </apex:column>    
                <apex:column headerValue="Start Date">
                    <apex:inputField value="{!TC.Start_Date__c}"/>
                </apex:column>
                <apex:column headerValue="End Date">
                    <apex:inputField value="{!TC.End_Date__c}"/>
                </apex:column>
                <apex:column headerValue="Monday Hours">
                    <apex:inputField value="{!TC.Monday_Hours__c}"/>
                </apex:column>
                <apex:column headerValue="Tuesday Hours">
                    <apex:inputField value="{!TC.Tuesday_Hours__c}"/>
                </apex:column>
                <apex:column headerValue="Wednesday Hours">
                    <apex:inputField value="{!TC.Wednesday_Hours__c}"/>
                </apex:column>
                <apex:column headerValue="Thursday Hours">
                    <apex:inputField value="{!TC.Thursday_Hours__c}"/>
                </apex:column>
                <apex:column headerValue="Friday Hours">
                    <apex:inputField value="{!TC.Friday_Hours__c}"/>
                </apex:column>                       
                <apex:column headerValue="Saturday Hours">
                    <apex:inputField value="{!TC.Saturday_Hours__c}"/>
                </apex:column>                             
                <apex:column headerValue="Sunday Hours">
                    <apex:inputField value="{!TC.Sunday_Hours__c}"/>
                </apex:column>
            </apex:pageBlockTable>
                <apex:pageBlockButtons >
                    <apex:commandButton value="Add Assignment Row" action="{!addAssignment}"/>
                    <apex:commandButton value="Save Assignments" action="{!save}"/>
                </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

and this is my current Apex Class Page:

public class AddanotherAssignmentController {

    public AddanotherAssignmentController(ApexPages.StandardSetController controller) {

    }

    pse__Assignment__c assignment = new pse__Assignment__c();
    public list<pse__Assignment__c> listAssignment{ get; set; }
    
    public AddanotherAssignmentController() {
        listAssignment=new list<pse__Assignment__c>();
        listAssignment.add(assignment);
    }
    
    Public void addAssignment() {
        pse__Assignment__c TC = new pse__Assignment__c();
        listAssignment = new List<pse__Assignment__c>();
        listAssignment.add(TC);
    }
    public PageReference saveAssignment() {
        for(Integer i=0; i<listAssignment.size(); i++) {
            insert listAssignment;
        }
        return Page.Allassignmentsaved;
    }
}

Any interpretation as to why I'm only getting one row added at a time would be very useful.

Many thanks,
Ethan


String userId = UserInfo.getUserId();
User u;
u=[SELECT Id, User_Pos__c FROM User WHERE Id =:userId limit 1];
 String userPos = u.User_Pos__c;

I want custom field value in my string please suggest.
Controller:
public class BankAccuont_TransactionStatus {
    public static void TransactionStatus(){
            List<Bank_Account__c> BankList = new List<Bank_Account__c>();
            List<Bank_Account__c> BList=[select id,Name,Account_Type__c,Number_Of_Transaction__c,Status__c from Bank_Account__c];
        for(Bank_Account__c b:BList){
            Bank_Account__c baccnt = new Bank_Account__c();
            if(b.Account_Type__c =='Current' && b.Number_Of_Transaction__c <=5){
                    baccnt.Status__c = 'Red';                  
                }
                else if(b.Account_Type__c=='Current' && b.Number_Of_Transaction__c == 6 || b.Number_Of_Transaction__c ==10){
                    baccnt.Status__c = 'Yellow';                    
                } 
            else if(b.Account_Type__c=='Current' && b.Number_Of_Transaction__c >= 10){
                    baccnt.Status__c = 'Green';
            }
            BankList.add(baccnt);            
        }
      // update BankList;
                
    }
}
=====================================================
trigger:
trigger Update_Status_Based_On_Transactions on Bank_Account__c (after insert,after update) {
    
    BankAccuont_TransactionStatus.TransactionStatus(trigger.new);
}
User-added imagewe have created a flow in our org. When we tried to test that, we are unable to login into Salesforce org.we have got this above error.we tried with forgot password, workbench technics, but no use. We raised a case to salesforce, no response from their side.Can please give me the solution as early as possible
Hi!
I have a master detail relationsip between Installation__c and Account. and ralation field between Installation__c  & Account is Site__c(API name).
I have a picklist (Time Zone) value on Account and Installation__c that are identical.
There are 5 values for the picklist.

Whenever the picklist value changes on Installation__c , I want to update the picklist value on Account  by using apex code only. But i'm getting null value at  insert accountstoUpdate; line.
Can anyone help, thanks in advance.

My apex class:
public class AccountTimeZoneUpdate {
       public static void accountTimeZone(List<Installation__c> newlist){ 
         set<Id> insId = new set<Id>();
        for(Installation__c inst : newList){
            insId.add(inst.id); 
        } 
     List<Installation__c> instList = [select id,Time_Zone__c Name from Installation__c];
          system.debug('installation list:'+instList);
           
           List<Account> accList = [select id,Time_Zone__c,name from  Account where Time_Zone__c =: null];
           
               system.debug('installation list:'+instList);
           List<Account> accountstoUpdate = new List<Account>();
          
           for(Installation__c insVar:instList){
               for(Account a: accList){
         //  Account acc = new Account();
              if(insVar.Time_Zone__c != null && insVar.Time_Zone__c != '') {
                   a.Time_Zone__c = insVar.Time_Zone__c;
                   accountstoUpdate.add(a);
              }
         }  
     }
            insert accountstoUpdate;
           system.debug('accountstoUpdate time:'+accountstoUpdate);
  }
}

My trigger:
trigger InstallationTrigger on Installation__c (after insert, after update) {
       if (Trigger.isAfter && (Trigger.isInsert || Trigger.isUpdate)){
            AccountTimeZoneUpdate.accountTimeZone(trigger.new);
        }
    
  • February 26, 2019
  • Like
  • 0
Hi, 
I just can't seem to get pass stage 10, as I keep getting, the below error:
"The View Lightning Campaign Influence Report link on the Campaign object must use a relative URL and dynamic filter values."
I have tried with different trail orgs and same issue persists.  Has anyone tried this challenge recently and do you have this issue?

The link in the button I have is "/one/one.app#/sObject/00O0N000004ti60/view?fv0={!Campaign.Id}" - the ID of the report is correct and when clicked from campaign it filters correctly.
Screenshot:
Campaign report link

 
Hi all,

Consider i have one object named as obj1 and have self-lookup within that. So record of obj1 can have multiple child records of the obj1(same object). Now i want to update child records when parent getting updated. How can i face this scenario? Please suggest any ideas.
Hi, 
 So I have an input field :<b>To: </b> <apex:inputfield value="{!q.contactid}"/><p/>

and in my controller, I have:
public Quote q {get;set;}

and then I would like to present the email address in this outputfield: <b>NAME: </b> <apex:outputtext value="{!q.contact.name}"/><p/> 

However this is not working, Please help: 
Below is my VF page: 
<apex:page standardController="Quote" extensions="email_class">
    <apex:form >
        <apex:pageBlock title="Email Details" id="ed">
            <b>To: </b> <apex:inputfield value="{!q.contactid}"/><p/>
         <apex:actionSupport event="onchange"  action="{!Contactpopulated}" rerender="ed"/>      
               <b>NAME: </b> <apex:outputtext value="{!q.contact.email}"/><p/> 
.......
.......

and my extension:
public class email_class{
        
    Public string ToAddresses {get;set;}
    Public string CCAddresses {get;set;}
    Public string quoteId {get;set;}
    Public string subject {get;set;}
    public string email_body {get;set;}
    public string emailTo {get;set;}
    public string emailCC {get;set;}
   public Quote q {get;set;}
   // public Contact ct {get;set;}
     public  string [] ccaddress; 
       
        public email_class(ApexPages.StandardController controller) {
                quoteId = ApexPages.currentPage().getParameters().get('id');
              Quote  q= (Quote)controller.getRecord();
    }

             public void Contactpopulated(){
       q.contact=[ Select  email, name From contact where  id=:q.contactid limit 1]; 
}


 
  • March 09, 2017
  • Like
  • 0
HI

My problem is I have created a 2 step approval process for a custom object.Now, if the  second step is not approved in 2 days then it should get automatically approved. I couldnt find any workaround to get this done but when is was looking for answers everyone has been recommending to write a trigger. can any1 help me to write a trigger that can automatically approve. for eg.  

if status is "Pending with the Team Head" 
and its crossed a 2 days (created a check box to caculated the days)
then it should auto approve. 

I am not good with triggers and hence requesting if you can solve it for me.

Reallly appreciate your help on this.

Thanks in Advance
Jabeen
Hi,

I want to get email template as a field in custom object(using lookup relationship). Is it possible? If it is how can i?
IF(RecordType.Name== 'Purchase Order', Name ='po-' CC_OrderNumber__c- 
CC_Sales_Order__r.CC_OrderNumber__c ,
 Name ='so-' 
CC_OrderNumber__c - 
CC_Project__r.Name )
Error: Syntax error. Missing ')'
Hi all,

I would like to integrate Quickbooks (External App) with the salesforce using the salesforce CANVAS feature. I highly appreicate for all your responses.

Thank you.