• Magdiel Herrera
  • NEWBIE
  • 45 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 18
    Replies
I have a JS function but it dont work, WHY?

RESULT: into inputText --> undefined
But I have the value outputText into inputText
Thank you

<apex:page standardController="CronTrigger" extensions="BBBB" >
<link rel="ic" type="image/png" href="http://www.voca.com/bull.png"/>

<script type="text/javascript">


function prepopulate(){
var getOPT = document.getElementById("{!$Component.theform.block01.aaa}").value;
document.getElementById("{!$Component.theform.block01.bbb}").value = getOPT;

}
    
</script>

<apex:form id="theform" >  
  <apex:PageBlock id="block01">
   
    <apex:outputText  id="aaa" value="{!$CurrentPage.parameters.nomJobPG2}" /><br />
    Nom Job.:&nbsp;<apex:inputText  id ="bbb" value="{!nomJob}" onclick="prepopulate();return false;"/><br /><br />

  </apex:PageBlock>
  </apex:form>
</apex:page>

Hi

May someone please help, I have written a trigger to create a record in a custom object when a status is changed on my assets. The test class I have passes but the percentage coverage is very low.

Trigger:

trigger createBillableSwappedAsset on Asset (after update) {

List <Billable_Swapped_Asset__c> auditTrailList = new List <Billable_Swapped_Asset__c>();

// or whatever your custom object name put instead of Vehicle__c

for ( Asset ass : Trigger.new) {

              if (Trigger.oldMap.get(ass.Id).Movement_Status__c != 'Swapped') {
 
 
  // here is where you check if asset that is being inserted meets the criteria
              if (ass.Movement_Status__c == 'Swapped' && ass.Product2Id != null && ass.Show_Device__c != true) { 


           
       //instantiate the object to put values for future record 
  Billable_Swapped_Asset__c  b =  new Billable_Swapped_Asset__c ();
        
  // now map asset fields to billable swapped asset that is being created with this asset
 
                      b.Company__c = Trigger.oldMap.get(ass.Id).AccountId;
                      b.Product__c = ass.Product2Id;
                      b.Install_Date__c =  ass.InstallDate;
                      b.End_Date__c = ass.UsageEndDate;
 
  auditTrailList.add(b);
 
 
  }//end if
 
}//end for ass

//once loop is done, you need to insert new records in SF
// dml operations might cause an error, so you need to catch it with try/catch block.
try {
  insert auditTrailList;
} catch (system.Dmlexception e) {
        system.debug (e);
    }
}

}


Test Class:

@isTest

private class TestCreateBillableSwappedAsset

{

static testMethod void TestCreateBillableSwappedAsset()
{
    Date todaysDate = System.today();
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
        
        //Create  & Insert Test User
  User u = new User(Alias = 'standt', Email='standarduser@sureswipe.com',
                  EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
                  LocaleSidKey='en_US', ProfileId = p.Id,
                  TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@sureswipe.com'); 
        System.runAs(u)
           
        {
          //Create and Insert Account
  Account a = new Account(Name = 'Test Company', Status__c = 'Active', Industry = 'Fashion',Type = 'Customer',
                                        Company_Email_Adress__c = 'test@test.com');
            insert a;
           
   //Create and Insert Asset
   Asset ass = new Asset(
   Name = 'Test Asset',
   Status = 'Installed',
   AccountId = a.Id,
   InstallDate = System.Today(),
   Product2Id = '01t200000024GTq',
   UsageEndDate = System.Today()
   );
   insert ass;

//Update Asset status to swapped
           
ass.status = 'Swapped';
ass.show_device__c = false;
update ass; 
           
//Update Asset status to swapped with show device true      
ass.status = 'Swapped';
ass.show_device__c = true;
update ass;
           
//Update Asset status to swapped with no product         
ass.status = 'Swapped';
ass.show_device__c = false;
ass.Product2Id = null;
update ass; 
           

        }
    }
}

  • June 19, 2014
  • Like
  • 1
I have a JS function but it dont work, WHY?

RESULT: into inputText --> undefined
But I have the value outputText into inputText
Thank you

<apex:page standardController="CronTrigger" extensions="BBBB" >
<link rel="ic" type="image/png" href="http://www.voca.com/bull.png"/>

<script type="text/javascript">


function prepopulate(){
var getOPT = document.getElementById("{!$Component.theform.block01.aaa}").value;
document.getElementById("{!$Component.theform.block01.bbb}").value = getOPT;

}
    
</script>

<apex:form id="theform" >  
  <apex:PageBlock id="block01">
   
    <apex:outputText  id="aaa" value="{!$CurrentPage.parameters.nomJobPG2}" /><br />
    Nom Job.:&nbsp;<apex:inputText  id ="bbb" value="{!nomJob}" onclick="prepopulate();return false;"/><br /><br />

  </apex:PageBlock>
  </apex:form>
</apex:page>

Hello
I have a JS function to prepopulate an inputText according to the outputText ...
Is not working.

Help me please!

<apex:page standardController="CronTrigger" extensions="BBpoll" >
<link rel="ic" type="image/png" href="http://www.voca.com/bull.png"/>


    
<script type="text/javascript">
function prepopulate(){
var getOPT = document.getElementById("{!$Component.theform.aaa}").value;
document.getElementById("{!$Component.theform.bbb}").value = getOPT;
}
</script>

 <apex:form id="theform" onclick="prepopulate();">
  <c:sectionHeader iconsrc="http://voc.srv1.votre-/lle.png" title="Planifiy" subtitle="=)"/>
  
  <apex:PageBlock >
    <apex:image id="theImage" styleClass="imageCenter" value="http://www.voca.com/logo.png" />
    <br /><br />
    <apex:outputText  id="aaa" value="{!$CurrentPage.parameters.nomJobPG2}" /><br />
    Nom Job.:&nbsp;<apex:inputText  id ="bbb" value="{!nomJob}" /><br /><br />

............

  </apex:PageBlock>
  </apex:form>
</apex:page>

Hi
Is it possible to modify a job schedulable created?
How do I do this in SF if I don't have the SAVE button on the part of MANAGE schedulable job?

Thank you
Hi All,

We would like to deactivate one user and want to assign another active user in all the email alerts,assignment rules associated with him.

1.We want to achieve it in a custom way.Because if there are 100 email alerts associated with the user we want to deactivate, manually it will take a lot of time.
2.Do we have any object from which we can get the data of email alerts,assignment rules related to a user?

Overall any idea related to deactivating a user succesfully and assign all its assignment rules and email alerts to other active users are welcome.

Thanks,
  • June 03, 2014
  • Like
  • 1
I'm trying to replace a custom Console written in VF with just the VF search component and then direct the user into a Service Console app where they can view the Contact details and/or create/edit a Case, etc.  The VF-only console provided a search facility which then dropped you into a Case Edit detail, but now the browsers no longer allow a visual.force.com url to open a salesforce.com url within the same context.

The URL of the console detail page is straightforward, but you can only open a page in the console if you're already in the console.  Does anyone know a way around this?
Hi, I'm trying accomplish the following business logic:

1. IF  opportunity record is a financial vertical type And IF the opportunity is above $500K
2. Create a task to send an email to opportunity owner.

Here's what I have so far . I would appreciate your input of whats missing or  filling the blanks to make it work .

trigger on OpportunityCreation on opportunity (before insert) {

 

    //loop through all new opportunities  saved

    for(Opportunity Op: Trigger.new)

    {

         // if the Opportunity amount is greater than 500000

         if (Op. Amount_c >= 500000)

//and  if Opportunity  Vertical  (customized  pick list field)  value = Financial

         If (Op. Vertical_c) = 'Financial'

                // create a user task that ...

               

            Task T = new Task();

            T.Type = 'Email';

            T.Description = Opportunity was created with amount  of  above 500,000 in your speciality field'; //string

            T.OwnerId = Op.OwnerId;

            //T.WhatId = ''; //record id

   

           insert T;

}
         else
         {
             // if the anual amount is less than 500000 and not financial vertical do nothing ....
         }
        
    }
}
Hi there,

I have created a class that stores trigger names to be deactivated during tests (I try to make a lot of unit tests, so I'm not interested in firing all my triggers on every test, and it is better to disable some of them to avoid reaching SOQL limits). So my tests have something like this:

TriggerDisabler.Disable('MyTriggerName');

And my triggers now add something like this as their first lines:
if (TriggerDisabler.IsTriggerDisabled('MyTriggerName')) {
    return;
}

But I would like to make this more generic, using something like a "trigger.Name" or something (without queries) that could return me the trigger's name, or eventually changing that method call in the trigger to "TriggerDisabler.AmIDisabled()" which could handle this itself.

Is this possible? I took a quick look in some forums and examples but couldn't find any way to obtain the trigger's name.

Any other suggestions are also welcome!

Cheers.
Hi friends,

We are fetching the data(Folder and files) from box.com using the custom code and sometimes it generates the error message "Invalid Http response".
We are using the rest Api (https://api.box.com/2.0/folders) to fetch folders and files.
Kindly suggest.

Regards
Manish Sharma

I have a service cloud console app with a visualforce page on the left side that lets a user search for accounts.  If they collapse the left side and then uncollapse it, the visualforce page has lost all of it's search parameter values and the result set of search items.  It's as if the page has reloaded.  Has anyone seen this before and come up with a solution?

Thanks,

Todd

Hi

May someone please help, I have written a trigger to create a record in a custom object when a status is changed on my assets. The test class I have passes but the percentage coverage is very low.

Trigger:

trigger createBillableSwappedAsset on Asset (after update) {

List <Billable_Swapped_Asset__c> auditTrailList = new List <Billable_Swapped_Asset__c>();

// or whatever your custom object name put instead of Vehicle__c

for ( Asset ass : Trigger.new) {

              if (Trigger.oldMap.get(ass.Id).Movement_Status__c != 'Swapped') {
 
 
  // here is where you check if asset that is being inserted meets the criteria
              if (ass.Movement_Status__c == 'Swapped' && ass.Product2Id != null && ass.Show_Device__c != true) { 


           
       //instantiate the object to put values for future record 
  Billable_Swapped_Asset__c  b =  new Billable_Swapped_Asset__c ();
        
  // now map asset fields to billable swapped asset that is being created with this asset
 
                      b.Company__c = Trigger.oldMap.get(ass.Id).AccountId;
                      b.Product__c = ass.Product2Id;
                      b.Install_Date__c =  ass.InstallDate;
                      b.End_Date__c = ass.UsageEndDate;
 
  auditTrailList.add(b);
 
 
  }//end if
 
}//end for ass

//once loop is done, you need to insert new records in SF
// dml operations might cause an error, so you need to catch it with try/catch block.
try {
  insert auditTrailList;
} catch (system.Dmlexception e) {
        system.debug (e);
    }
}

}


Test Class:

@isTest

private class TestCreateBillableSwappedAsset

{

static testMethod void TestCreateBillableSwappedAsset()
{
    Date todaysDate = System.today();
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
        
        //Create  & Insert Test User
  User u = new User(Alias = 'standt', Email='standarduser@sureswipe.com',
                  EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
                  LocaleSidKey='en_US', ProfileId = p.Id,
                  TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@sureswipe.com'); 
        System.runAs(u)
           
        {
          //Create and Insert Account
  Account a = new Account(Name = 'Test Company', Status__c = 'Active', Industry = 'Fashion',Type = 'Customer',
                                        Company_Email_Adress__c = 'test@test.com');
            insert a;
           
   //Create and Insert Asset
   Asset ass = new Asset(
   Name = 'Test Asset',
   Status = 'Installed',
   AccountId = a.Id,
   InstallDate = System.Today(),
   Product2Id = '01t200000024GTq',
   UsageEndDate = System.Today()
   );
   insert ass;

//Update Asset status to swapped
           
ass.status = 'Swapped';
ass.show_device__c = false;
update ass; 
           
//Update Asset status to swapped with show device true      
ass.status = 'Swapped';
ass.show_device__c = true;
update ass;
           
//Update Asset status to swapped with no product         
ass.status = 'Swapped';
ass.show_device__c = false;
ass.Product2Id = null;
update ass; 
           

        }
    }
}

  • June 19, 2014
  • Like
  • 1