• Peter_sfdc
  • SMARTIE
  • 998 Points
  • Member since 2012

  • Chatter
    Feed
  • 25
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 191
    Replies
Hi, I have the requirement like this. Say I have a Visualforce page which has '<apex:page> This is a new page </apex:page>'. Then I want an audio player on that page which will play this exact statement "This is a new page." Is this possible to be done in Apex? Or through Javascript on Apex? If anyone has done this or know about how it can be implemented, please share the relevant steps and code. 
trigger Trg_IntegrityIndex on Project__c (before update) {
    
    for(Project__c P : Trigger.New){
        String PID = p.Id;
        Project__c P1=[select Id,Name,Status__r.Name, Value__c, ContractValue__c, Contract__r.Name, Country__c, Workflow__c, CreatedDate,Scope__c  from Project__c where Id=:PID];
        
        string Status =P1.Status__r.Name;
        String sContract =P1.Contract__r.Name;
        String sContractValue =String.Valueof(P.ContractValue__c);
        String sScope =String.valueof(P.Scope__c);
        String sIndustry=P.Industry__c;
        String sName=P.Name; //for Project name
        String sScopeReplace;
        Integer iScope =0;
        
        Boolean bBad=false;
        Boolean bFair=false;
        String sErrorComments='';
  List<News__c> News= [select Id,Date__c,Name from News__c where Project__c=:PID];
        if (News.Size() >0){
              for(News__c N :News){
              //Validation 8: News:News-Study    Should be within 90 days from today   except design build in contract type             
                if(Status=='Study' &&  !(sContract=='Design Build (DB)')){
                  if(N.Date__c > date.today() +90 && N.Date__c < date.today() +97){
                    bFair = True; 
                    sErrorComments +='Status-Study Should be within 90 days from today for News Record-' + N.Name + '\r\n'; 
                  }else if (N.Date__c > date.today() +97){
                    bBad= True; 
                    sErrorComments +='Status Study as exceeded 97 days from today for News Record-' + N.Name + '\r\n';                                         
                  } 
               } 
i wrote test class below i dont know what is wrong in this can anyone have solutions for this . Kindly help me.

@isTest 
Public class testIntegrity{
    public static void init()
    {
        List <Project__c> proj = New List<Project__c>();
        Public Static String PID = p.Id;
        Project__c sproj=[select Id,Name,Status__r.Name, Value__c, ContractValue__c, Contract__r.Name, Country__c, Workflow__c, CreatedDate,Scope__c  from Project__c where Id=:PID];
        Public Static String Status = sproj.Status__r.Name;
        Public Static String sContract =sproj.Contract__r.Name;
        Public Static String sContractValue =String.Valueof(sproj.ContractValue__c);
        
    }
    
    
@isTest Static void testinsertproject()
    {
        
        Project__c sproj = New Project__c();
        sproj.Parent__c = 'a042000000IPjwg';
        sproj.Name ='Abu Dhabi Commercial Bank - Office Building';
        sproj.Type__c='a0I200000064HgY';
        sproj.Type_MCI__c='a0I200000064HgY';
        sproj.Location__c ='a0I20000006hEdO';
        sproj.Workflow__c = 'Recalled';
        sproj.Status__r.Name = 'Study';
        sproj.Inactive__c=true;
        sproj.Value__c=400;
        sproj.Integrity_Errors__c='Scope Should be more than 5 Pointers for the Status :Design';
        sproj.ContractValue__c=40;
        sproj.Contract__r.Name='Design Build (DB)';
        //sproj.Contract_Type_MCI__c='Build';
        sproj.Scope__c='Abu Dhabi Commercial Bank is constructing an office building in Abu Dhabi.\n\nScope of the project includes:\n*Office building (12-storey)\n*Associated facilities';
        sproj.Brownfield__c=false;
        sproj.Offshore__c=false;
        insert sproj;
        
        
        News__c sobj = New News__c();
        sobj.Inactive__c = false;
        sobj.News__c = 'fsfsfdsgsddsf';
        sobj.Date__c = Date.valueOf('20-10-2017');
        sobj.Source_Type__c ='Primary';
        sobj.Number_of_Updates__c ='2';
        sobj.Project__c = sobj.Id;
        insert sobj;
        
        
        if(sproj.Status__c =='Study' && !(sproj.Contract__c=='Design Build (DB)'))
        {
            String spro = String.valueof(sproj.Id);
            if(sobj.Date__c>date.today() +90 && sobj.Date__c<date.today() +97 )
            {
                
            }
            else if(sobj.Date__c > date.today()+97)
            {
               //do nothing 
            }
                
        }
    
        }
    
}

Thanks 
I have enabled platform encryption in my org. i want to decrypt that data using tenant secret ? please explain
I am planning to take the 201, 211 and 401 certifications - does anyone know do the Trailhead modules align to these and if so which modules do you need to do for each certification?

Thanks all
Jim
Hi there, I 'm trying to complete the "Automating Processes with the Lightning Process Builder" challenge in TrailHead but I get the following error :
Encountered unhandled fault when running process Update_contact_adress/
301240000004FXO exception by user/organization: 00D24000000JsNt/{4}

The flow failed to access the value for myVariable_current.Account.ShippingCountry because it hasn't been set or assigned.
caused by element : FlowRecordUpdate.myRule_1_A1
caused by: The flow failed to access the value for myVariable_current.Account.ShippingCountry because it hasn't been set or assigned.
Salesforce Error ID: 490660201-42718 (736882147)

Any idea what could be could wrong ?
 
Good afternoon,
I can't seem to figure out why my class for the "Getting Started with Apex: Unit 1" won't pass evaluation.  The class appears to work as expected when I run via the Execute Anonymous window, but the checker fails.

Here is my class:

public class StringArrayTest{
    public static void generateStringArray(integer q){
        list<string> test = new list<string>();
            for(integer i=0; i < q;i++){
            test.add('Test '+i);
            system.debug(test[i]);
        }
    }
}

When I run StringArrayTest.generateStringArray(9); in the EAW, I get the return I expected.
Thoughts?

Hi there,

I'm looking to send information from a form that is already created and in use on a website to salesforce web to lead, have tried diferent methods but it doesn't record.

Its there a simple way of doing that?

Kind regards,

Hi, We have articles created using multilingual knowledge in Salesforce. The article have field rich text.

We are using anchor for navigation in same page. Anchor works fine in English but not in french and other languages.

I checked clicking on Source button and found in french lang the anchor name is not populated.

English (Working):
Link: <a href="#Required parts"><span class="ref_span">
Anchor: <a name="Required parts">Required parts</a></div>

French version (Not Working):
Link: <a href="#Pièces Requises"><span class="ref_span">
Anchor: <a name="" target="_blank">Pi&egrave;ces requises</a></div>

I tried work around each time clicking on source and put the name in anchor which works fine but its not good for user and publishers to go and manually change each time. Also this work around doesn't work in IE8.

Need your important inputs.. Thanks..
Hi , 
It`s bit urgent , can any one please help me to resolve the bellow issue 
https://developer.salesforce.com/forums/?feedtype=RECENT&dc=Java_Development&criteria=ALLQUESTIONS&#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Java_Development&criteria=ALLQUESTIONS&id=906F0000000Af0bIAC
Hi I am trying to move attachments from any outbound email message back to the parent, in this case it's Cases. I created a trigger on Attachment and check the incoming flag and copy the attachments and then delete but it never does anything. Has anyone come across this problem?
HI,
I have created a flow and to customize the flow ,i have created a vf page with the controller. So can anyone tell me that how to write a test class to call the flow ...?
I tried each and every possibility to know where i'm going wrong but still no luck. My issue is my search (i.e. filter) is working on Subject,Status and Date field for Task object .

Now i want to search for one more column which is "OwnerId" . I know it can be done using if condition something like below  but what should be "IF condition " to get to the goal ?

if (logical condition  to filter by owner) {
    qStr + ' and OwnerId in :ownerIds';


I'm really paralyzed and need help.

public class PagingTasksController1{

    public List<Task> Tasks;

   
    public Task del;
    public Task taskDel;
    public Integer CountTotalRecords{get;set;}
    public String QueryString {get;set;}
    public Integer OffsetSize = 0;
    private Integer QueryLimit =3 ;
    public List<Task> lstTasks {get;set;}
    public String searchText {get;set;}
    public String rowIndex {get;set;}
//   public List<Task> attendeeList {get;set;}
    public Date mydate;
    public Integer totalCount {get;set;}
    public string sortField = 'Subject';  // default sort column
    private string sApplySOQL = '';
   public List<Task> delattendeeList {get;set;}

    public List<Task> delAttendees {get; set;}

    public PagingTasksController1(ApexPages.StandardController controller) {

     taskDel= (Task)controller.getRecord();
     Tasks = [Select id,Subject,Status,ActivityDate from Task where OwnerId =: taskDel.Id];
    // this.Tasks=Tasks[0];
     totalCount = Tasks.size();

     delattendeeList = new List<Task>();
     delattendees = new List<Task>();
}


// the current sort direction. defaults to ascending
    public String sortDir {
        get  { if (sortDir == null) {  sortDir = 'asc'; } return sortDir;  }
        set;
    }

    // the current field to sort by. defaults to role name
    public String getsortField() {
        return sortField;
    }

    // the current field to sort by.
    public void setsortField(string value) {
        sortField = value;
    }
            
    // toggles the sorting of query from asc<-->desc
    public void toggleSort() {
        // simply toggle the direction
        sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
      
        integer iIndex = sApplySOQL.indexOf('Order By');
        if (iIndex > -1){
          sApplySOQL = sApplySOQL.substringBefore('Order By');
          sApplySOQL = sApplySOQL + ' Order By ' + sortField + ' ' + sortDir +  ' limit ' + QueryLimit + ' offset ' + OffsetSize;
        }
        tasks = Database.query(sApplySOQL );
    }
  
    public PagingTasksController1 (){
        //CountTotalRecords= [select count() from Task];
        //String qStr2= '7/23/2014';
          
    }

   public List<Task> getTasks(){
        if(tasks == null){
            tasks = new List<Task>();
        }
        return tasks;
    }

    public void findTasks(){
        String qStr2 = 'Select count() from Task where Subject like \'%'+searchText+'%\' OR Status like \'%'+searchText+'%\'';
        CountTotalRecords = Database.countQuery(qStr2);
        queryTasks();
    }

    public void  queryTasks(){
        
        String qStr2= searchText;
        String strnormal = '';
        try{
             mydate = date.parse(qStr2);
        }catch(Exception e)
        { }
           
        String strDate = '';
        if(mydate != null) {
         // strnormal = String.valueOf(mydate );
          String[] qstr3 = String.valueOf(mydate).split(' ',2); 
          strDate = ' ActivityDate =  '+ qstr3[0] + ' ';
        }else{
       
           strDate  =  'Subject like \'%'+searchText +'%\' OR Status like \'%' +searchText+ '%\' Order By '  + sortField;
        }
        String qStr = 'Select OwnerId,Subject,Status,ActivityDate from Task where '  + strDate   ;

         System.debug(qStr );
           
//        String qStr = 'Select OwnerId,Subject,Status,Priority from Task where Subject like \'%'+searchText+'%\' OR Status like \'%'+searchText+ '%\' Order By ' + sortField;

       
       
        sApplySOQL = qStr;
      
        tasks = Database.query(sApplySOQL );
        //tasks.sort();

    }

    public Boolean getDisablePrevious(){
        if(OffsetSize>0){
            return false;
        }
        else return true;
    }

    public Boolean getDisableNext() {
        if (OffsetSize + QueryLimit < countTotalRecords){
            return false;
        }
        else return true;
    }

    public PageReference Next() {
        OffsetSize += QueryLimit;
        queryTasks();
        return null;
    }

    public PageReference Previous() {
        OffsetSize -= QueryLimit;
        queryTasks();
        return null;
    }

      public PageReference save() {
        update tasks;
        return ApexPages.CurrentPage();
     }
    
    public void deleteRow(){

         rowIndex = String.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
         System.debug('rowIndex ------------'+rowIndex );
         if(rowIndex!=null)
         {
         Task check=[Select id from Task where id=: rowIndex];
         System.debug('row to be deleted ' + check);
         delete check;
         Tasks=[Select Subject,Status,ActivityDate,OwnerId from Task ];
         update Tasks;
         }
     }
     
  }
Hello,

Can we call one Apex:Component inside the other Apex:Component?

Please suggest some ways to accomplish this.


Thanks,
Mayank