• Peter Friberg 26
  • NEWBIE
  • 50 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 10
    Replies
Hello,

Is there any way to duplicate a object or a more simpler way to create object rather than the tradional way.
(My object has 300 fields)

Thanks
  • October 05, 2015
  • Like
  • 0
Normally when creating Javascript methods in Visualforce they exist in the same scope, e.g. you can call one method from another with parameters. Just as the two functions findNext() and findPrev() calls findAndFocus() here:
function findPrev() {
    search_index--;
    findAndFocus(text, search_index);
}

function findNext() {
    search_index++;
    findAndFocus(text, search_index);
}

function findAndFocus(str, stop_at) {
    // Do something
}
But when using Lightning how do you call one method from another?
({
    findPrev : function (component, event, helper) {
        search_index--;
        findAndFocus(text, search_index); // What to write here?
    },
    
    findNext : function (component, event, helper) {
        search_index++;
        findAndFocus(text, search_index); // What to write here?
    },

    findAndFocus : function(text, stop_at) {
        // Do something
    }
})
What is the best practice? Is it to move all methods for reuse into the helper client side Javascript file?
What if the helper file methods need to call other methods within the same helper Javascript file?

Any thoughts or ideas?
 
When you create a lightning component and put that on an opportunity record home page (oppty detail page), it is pilot functionality right now. 
I created a lightning component that draws some graphics and it is dependent on some felds on the oppty and some related records (task & events). So if I change the close date I need to refresh my component, but also if a new task/event is added from the oppty page I need to redraw the component.

What event do you need to listen to in order to detect a change on any field on the oppty itself? Or do I need to do something else?

Any ideas?
Normally when creating Javascript methods in Visualforce they exist in the same scope, e.g. you can call one method from another with parameters. Just as the two functions findNext() and findPrev() calls findAndFocus() here:
function findPrev() {
    search_index--;
    findAndFocus(text, search_index);
}

function findNext() {
    search_index++;
    findAndFocus(text, search_index);
}

function findAndFocus(str, stop_at) {
    // Do something
}
But when using Lightning how do you call one method from another?
({
    findPrev : function (component, event, helper) {
        search_index--;
        findAndFocus(text, search_index); // What to write here?
    },
    
    findNext : function (component, event, helper) {
        search_index++;
        findAndFocus(text, search_index); // What to write here?
    },

    findAndFocus : function(text, stop_at) {
        // Do something
    }
})
What is the best practice? Is it to move all methods for reuse into the helper client side Javascript file?
What if the helper file methods need to call other methods within the same helper Javascript file?

Any thoughts or ideas?
 
Hii all,
I am getting this error List index out of bounds: 2060.
Here my Total Size is 2063.
for(Integer j=total_size-Math.mod(total_size,list_size);j<total_size;j++)
                    {
                        ListWrap.add(wraplist.get(j));
                    
                    }


                        
Hi all,

 I need to run the schedule class for every day @ 1 PM ...........

Here is the my batch class

global class  sendwagenoticestoemployees Implements Database.Batchable <sObject> {
    global Database.queryLocator start(Database.BatchableContext bc) {
        
        String SOQL = 'SELECT Id, WTPAA_Employee_Email__c,WTPAA_Related_To__c,WTPAA_Living_Wage__c FROM WTPAA_Wage_Notice__c WHERE WTPAA_Living_Wage__c =  false ';
        return Database.getQueryLocator(SOQL);
    }

    global void execute(Database.BatchableContext bc, List<WTPAA_Wage_Notice__c> wagenotice) {
        List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>();
       Emailtemplate et = [select id, developername , IsActive from Emailtemplate where developername = 'WTC_Offer_is_Ready_for_Review' AND IsActive = true];
        for(WTPAA_Wage_Notice__c w: wagenotice) {
            List<String> toAddresses = new List<String>{w.WTPAA_Employee_Email__c};           
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setToAddresses(toAddresses);
          
            mail.SetTemplateid(et.id);
            mail.setSaveAsActivity(false);
          
           mail.setTargetObjectId(w.WTPAA_Related_To__r.id);
           system.debug('ID of Contact' +w.WTPAA_Related_To__r.id);
          
            system.debug('IDDDDDDDDDDD*******' +et.id);
            mailList.add(mail);   
            system.debug('size of the list' +mailList.size() );    
        } 
        Messaging.sendEmail(mailList);        
    }

    global void finish(Database.BatchableContext bc) {
    }
}

 
please help me out.
 
  • October 08, 2015
  • Like
  • 0
Normally when creating Javascript methods in Visualforce they exist in the same scope, e.g. you can call one method from another with parameters. Just as the two functions findNext() and findPrev() calls findAndFocus() here:
function findPrev() {
    search_index--;
    findAndFocus(text, search_index);
}

function findNext() {
    search_index++;
    findAndFocus(text, search_index);
}

function findAndFocus(str, stop_at) {
    // Do something
}
But when using Lightning how do you call one method from another?
({
    findPrev : function (component, event, helper) {
        search_index--;
        findAndFocus(text, search_index); // What to write here?
    },
    
    findNext : function (component, event, helper) {
        search_index++;
        findAndFocus(text, search_index); // What to write here?
    },

    findAndFocus : function(text, stop_at) {
        // Do something
    }
})
What is the best practice? Is it to move all methods for reuse into the helper client side Javascript file?
What if the helper file methods need to call other methods within the same helper Javascript file?

Any thoughts or ideas?
 
Hi,

I am trying to display a custom enhanced list view , which is a visualforce page. Right now I can retrive the Incident Number by Database.getQueryLocator. And able to show in my list view.

I also want to display my custom field, short description in my list view, which I am not able to disply. 

I am defining custom contoller setCon, which will get incident number and short description value from database. But while trying to display in list view page, only incident numer is getting populated. Am I going any wrong way. 

I am going it by <apex:column value="{!Inc.Short_Description__c}"/>
Here my custom object name is Incident__c

Here is my Page

********************
<apex:page controller="EnhancedListExtention" showHeader="false" sidebar="false" showChat="false" id="pg_id">
    
    <script type="text/javascript">
    // This will give you alert msg when record submitted successfully.
 
    window.onload = new function() 
    { 
           submitForm();        
    }

    function submitForm() 
    {
        alert("Record Created Sucessfully");
        
    }
    </script>
        
    <apex:form id="frm_id" >
        <apex:pageBlock id="pgblk_id">  

            <apex:pageBlockTable value="{!incidents}" var="Inc" id="tbl_id">
                 
                <!-- This make the name field as hyperlink on click it will navigate to detailed page as readonly -->                
                <apex:column headerValue="Name" id="clm_id" >
                    <apex:outputLink value="javascript:void(0);" onclick="window.open('/{!Inc.id}');" >{!Inc.name}</apex:outputLink>
                 </apex:column>
                              
                <apex:column value="{!Inc.Short_Description__c}"/>
              
                
            </apex:pageBlockTable>
           
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="First" action="{!setCon.first}"/>
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="Previous" action="{!setCon.previous}"/>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) < setCon.ResultSize}" value="{!setCon.pageNumber * setCon.pageSize} Of {!setCon.ResultSize}"></apex:outputText>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) >= setCon.ResultSize}" value="{!setCon.ResultSize} Of {!setCon.ResultSize}"></apex:outputText>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="Next" action="{!setCon.next}"/>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="Last" action="{!setCon.last}"/>
           
        </apex:pageBlock>
    </apex:form>
    
</apex:page>

Apex Class
****************

public class EnhancedListExtention {
// ApexPages.StandardSetController must be initiated   
// for standard list controllers   
    
    public Incident__c Inc {get;set;}   
    public ApexPages.StandardSetController setCon {
  
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                      [select Name,Short_Description__c from Incident__c ORDER BY Name DESC NULLS LAST]));
            }
            return setCon;
        }
        set;
    }

    // Initialize setCon and return a list of records
   
    public List<Incident__c> getIncidents() {
         setCon.setpagesize(10);
         return (List<Incident__c>) setCon.getRecords();
    }
   
}

List View Generated

Many Thanks in Advance
-SAKTI
Hi everyone, I am beginner  of trigger development. I have 2 custom object 'Vente_c' & 'Tissus__c'. I would calculate the total stock of tissues after passing the sale. My code has no errors but nothing happens. Would you help me please..
trigger StockUpdateTissu on Vente__c (after delete, after insert, after update) {
    set<Id> set_Id = new set<Id>();
       
    if(trigger.isInsert || trigger.isUpdate)
    for(Vente__c v : Trigger.new)
    set_Id.add(v.Tissus__c);
    
    if(trigger.isDelete)
    for(Vente__c v : Trigger.old)
    set_Id.add(v.Tissus__c);
    
    List<Tissus__c> listTissus = new List<Tissus__c>([SELECT ID FROM Tissus__c WHERE ID IN :set_Id]);
    List<Vente__c> listVente = new List<Vente__c>([SELECT ID FROM Vente__c WHERE ID IN :set_Id]);
    
    for(Tissus__c t : listTissus ){
        t.Stock_actuel__c=500;
        
        for(Vente__c v : listVente ) 
       
        t.Stock_actuel__c -= v.Metrage_tissus_vendu__c;
     }
     update listTissus;
}

 
Hi All,
How To Write Test Class For Below Trigger.
trigger create_zapping_rec_Empaccount on Account(before insert)
{
 list<Zapping_Directory__c> zappinglist = new list<Zapping_Directory__c>();
 for(Account c:trigger.new)
 {
  if(c.RecordTypeId=='6666464564')
  {
  Zapping_Directory__c zap = new Zapping_Directory__c(Name=c.Company_Name__c,Company_Type__c=c.Company_Type__c,Main_Industry__c=c.Industrys__c
  );
  zappinglist.add(zap);
  }
  insert zappinglist;
 }
}
Thanks 
Srikanth.
Hello,

Is there any way to duplicate a object or a more simpler way to create object rather than the tradional way.
(My object has 300 fields)

Thanks
  • October 05, 2015
  • Like
  • 0
Curious what the best approach is to replace custom buttons that are currently using OnClick Javascript or URL since they are no longer supported when switching to Lightning Experience. Is it best to replace the classic buttons by building a new buton using the Lightning Design System framework within Lightning components and then adding to the page layout?

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.