• Lucas Arruda 8
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Hello, I'm trying to create a validation rule the checks if an status field into the Quote object is filled, if so the system should let the end user change the  status field of the other object to closed. I have created the validation rule bellow, however the validation didn't work. the validation it is requesting me to fill the status field during the record creation.
 
IF(
AND(
ISCHANGED(Fase__c),
ISPICKVAL(Fase__c, 'Closed'),
ISBLANK(
TEXT(Oportunidade__r.SyncedQuote.StatusECR__c)
)),false,true)

Thanks,
Lucas
Hello,

I'm trying to test the trigger below, however my test is not passing in the IF condition.

Trigger
trigger ValidateLead on Lead (before insert, before update){

	if (Trigger.isBefore) {
    	for(Lead led : trigger.new){

    		Lead leds = [SELECT Id, Name FROM Lead WHERE id=: led.Id];
    		
    			if(ValidaDocumento.isCNPJ(led.CNPJ__c))
    				led.CNPJ__c = ValidaDocumento.imprimeCNPJ(led.CNPJ__c);
    			else
    				led.addError('O CNPJ informado é Inválido');
	    }
    }
}

test class:
public static testMethod void createLead() {
	    
	    Lead prospect = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = 'teste',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		ValidaDocumento.isCNPJ(prospect.CNPJ__c);
		ValidaDocumento.imprimeCNPJ(prospect.CNPJ__c);
		insert prospect;
		
		Lead prospect2 = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = '68119173000167',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		ValidaDocumento.isCNPJ(prospect2.CNPJ__c);
		insert prospect2;
		
		Lead prospect3 = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = '00000000000000',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		insert prospect3;
		ValidaDocumento.isCNPJ(prospect3.CNPJ__c);
		
		Lead prospect4 = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = '11111111111111',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		insert prospect4;
		ValidaDocumento.isCNPJ(prospect4.CNPJ__c);
		
		Lead prospect5 = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = '681191730001',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		insert prospect5;
	    ValidaDocumento.isCNPJ(prospect5.CNPJ__c);
	}
}
I'm in doubt how to make the test pass through my if conditional.
 
Hello,

I'm trying to create a message page on the service cloud page, in my page it appearing the tag <p>  like the example bellow:

User-added image

How can I remove that using my code bellow:
 
<apex:page showHeader="false">

<style>
body {
    padding: 10px;
}
</style>

<style>

.classname {
    -moz-box-shadow:inset 0px 1px 0px 0px #bbdaf7;
    -webkit-box-shadow:inset 0px 1px 0px 0px #bbdaf7;
    box-shadow:inset 0px 1px 0px 0px #bbdaf7;
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #79bbff), color-stop(1, #378de5) );
    background:-moz-linear-gradient( center top, #79bbff 5%, #378de5 100% );
    filter:progid:DXImageTransform.Microsoft.gradient(
    Colorstr='#79bbff', endColorstr='#378de5');
    background-color:#79bbff;
    -webkit-border-top-left-radius:10px;
    -moz-border-radius-topleft:10px;
    border-top-left-radius:10px;
    -webkit-border-top-right-radius:10px;
    -moz-border-radius-topright:10px;
    border-top-right-radius:10px;
    -webkit-border-bottom-right-radius:10px;
    -moz-border-radius-bottomright:10px;
    border-bottom-right-radius:10px;
    -webkit-border-bottom-left-radius:10px;
    -moz-border-radius-bottomleft:10px;
    border-bottom-left-radius:10px;
    text-indent:0;
    border:1px solid #84bbf3;
    display:inline-block;
    color:#ffffff;
    font-family:Arial;
    font-size:10px;
    font-weight:bold;
    font-style:normal;
    height:30px;
    line-height:30px;
    width:50px;
    text-decoration:none;
    text-align:center;
    text-shadow:1px 1px 0px #528ecc;
    margin-left:10px;
}
.classname:hover {
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #378de5), color-stop(1, #79bbff) );
    background:-moz-linear-gradient( center top, #378de5 5%, #79bbff 100% );
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#378de5', endColorstr='#79bbff');
    background-color:#378de5;
}.classname:active {
    position:relative;
    top:1px;
}
</style>

    <div style="margin-left:auto; margin-right:auto;width:50%;">
    <input type="button" class="classname" onclick="scrollButtonText(); return false;" value="Iniciar" />
    <input type="button" class="classname" onclick="setButtonText(); return false;" value="Parar" />
    </div>
  
    <apex:includeScript value="/support/console/29.0/integration.js"/>

    <script>
   
       function setButtonText() {
           sforce.console.setCustomConsoleComponentButtonText('Alerts');         
       }
       
       function blinkButtonText() {
            sforce.console.blinkCustomConsoleComponentButtonText('Hello World', 3000);
       }              
    
    </script>
    
  
    <chatter:feed entityId="0F9g00000009Jgo" rendered="true" />
    
   
    <!-- <input type="button" onclick="blinkButtonText(); return false;" value="Blink Button Text" /> -->
     
    <script>
        function srcUp(url) {
            sforce.console.openPrimaryTab(null, url, true);
        }
        
        setInterval(function(){window.location.href = window.location.href;},600000);
         
        function getFeedItemBody() {
            var feeds = '';
            var elements = document.getElementsByClassName('feeditemtext');
            for (var i=0; i<elements.length; i++) {                
                feeds += elements[i].innerHTML + "         ";
            }
            return feeds;
        }        
        
        var feedItems = getFeedItemBody();

        scrollButtonText();       
                
        function scrollButtonText() {                   
            sforce.console.setCustomConsoleComponentButtonText(feedItems, function() {
                sforce.console.scrollCustomConsoleComponentButtonText(150, 5, true, function(result){});            
            });
         }
       
    </script>

</apex:page>

Thank you!
 
Hello,

I'm tryin to execute a method using the anonymous execute functionality, however the method that i'm trying to execute it is using a object as a paramter, and when i try to pass an Id de execution gives me an error saying that the param type for string is invalid.

className.doTransfer(transfer__c pTransf)

So I want to know how can I execute this method.

Thank you!
Hello, I'm trying to create a validation rule the checks if an status field into the Quote object is filled, if so the system should let the end user change the  status field of the other object to closed. I have created the validation rule bellow, however the validation didn't work. the validation it is requesting me to fill the status field during the record creation.
 
IF(
AND(
ISCHANGED(Fase__c),
ISPICKVAL(Fase__c, 'Closed'),
ISBLANK(
TEXT(Oportunidade__r.SyncedQuote.StatusECR__c)
)),false,true)

Thanks,
Lucas
Hello,

I'm trying to test the trigger below, however my test is not passing in the IF condition.

Trigger
trigger ValidateLead on Lead (before insert, before update){

	if (Trigger.isBefore) {
    	for(Lead led : trigger.new){

    		Lead leds = [SELECT Id, Name FROM Lead WHERE id=: led.Id];
    		
    			if(ValidaDocumento.isCNPJ(led.CNPJ__c))
    				led.CNPJ__c = ValidaDocumento.imprimeCNPJ(led.CNPJ__c);
    			else
    				led.addError('O CNPJ informado é Inválido');
	    }
    }
}

test class:
public static testMethod void createLead() {
	    
	    Lead prospect = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = 'teste',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		ValidaDocumento.isCNPJ(prospect.CNPJ__c);
		ValidaDocumento.imprimeCNPJ(prospect.CNPJ__c);
		insert prospect;
		
		Lead prospect2 = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = '68119173000167',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		ValidaDocumento.isCNPJ(prospect2.CNPJ__c);
		insert prospect2;
		
		Lead prospect3 = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = '00000000000000',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		insert prospect3;
		ValidaDocumento.isCNPJ(prospect3.CNPJ__c);
		
		Lead prospect4 = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = '11111111111111',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		insert prospect4;
		ValidaDocumento.isCNPJ(prospect4.CNPJ__c);
		
		Lead prospect5 = new Lead(
	        
			LastName = 'TestProspect',
			CNPJ__c = '681191730001',
			Company = 'TestCompany',
			Estado__c = 'SP'
		);
		insert prospect5;
	    ValidaDocumento.isCNPJ(prospect5.CNPJ__c);
	}
}
I'm in doubt how to make the test pass through my if conditional.
 
Hello,

I'm trying to create a message page on the service cloud page, in my page it appearing the tag <p>  like the example bellow:

User-added image

How can I remove that using my code bellow:
 
<apex:page showHeader="false">

<style>
body {
    padding: 10px;
}
</style>

<style>

.classname {
    -moz-box-shadow:inset 0px 1px 0px 0px #bbdaf7;
    -webkit-box-shadow:inset 0px 1px 0px 0px #bbdaf7;
    box-shadow:inset 0px 1px 0px 0px #bbdaf7;
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #79bbff), color-stop(1, #378de5) );
    background:-moz-linear-gradient( center top, #79bbff 5%, #378de5 100% );
    filter:progid:DXImageTransform.Microsoft.gradient(
    Colorstr='#79bbff', endColorstr='#378de5');
    background-color:#79bbff;
    -webkit-border-top-left-radius:10px;
    -moz-border-radius-topleft:10px;
    border-top-left-radius:10px;
    -webkit-border-top-right-radius:10px;
    -moz-border-radius-topright:10px;
    border-top-right-radius:10px;
    -webkit-border-bottom-right-radius:10px;
    -moz-border-radius-bottomright:10px;
    border-bottom-right-radius:10px;
    -webkit-border-bottom-left-radius:10px;
    -moz-border-radius-bottomleft:10px;
    border-bottom-left-radius:10px;
    text-indent:0;
    border:1px solid #84bbf3;
    display:inline-block;
    color:#ffffff;
    font-family:Arial;
    font-size:10px;
    font-weight:bold;
    font-style:normal;
    height:30px;
    line-height:30px;
    width:50px;
    text-decoration:none;
    text-align:center;
    text-shadow:1px 1px 0px #528ecc;
    margin-left:10px;
}
.classname:hover {
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #378de5), color-stop(1, #79bbff) );
    background:-moz-linear-gradient( center top, #378de5 5%, #79bbff 100% );
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#378de5', endColorstr='#79bbff');
    background-color:#378de5;
}.classname:active {
    position:relative;
    top:1px;
}
</style>

    <div style="margin-left:auto; margin-right:auto;width:50%;">
    <input type="button" class="classname" onclick="scrollButtonText(); return false;" value="Iniciar" />
    <input type="button" class="classname" onclick="setButtonText(); return false;" value="Parar" />
    </div>
  
    <apex:includeScript value="/support/console/29.0/integration.js"/>

    <script>
   
       function setButtonText() {
           sforce.console.setCustomConsoleComponentButtonText('Alerts');         
       }
       
       function blinkButtonText() {
            sforce.console.blinkCustomConsoleComponentButtonText('Hello World', 3000);
       }              
    
    </script>
    
  
    <chatter:feed entityId="0F9g00000009Jgo" rendered="true" />
    
   
    <!-- <input type="button" onclick="blinkButtonText(); return false;" value="Blink Button Text" /> -->
     
    <script>
        function srcUp(url) {
            sforce.console.openPrimaryTab(null, url, true);
        }
        
        setInterval(function(){window.location.href = window.location.href;},600000);
         
        function getFeedItemBody() {
            var feeds = '';
            var elements = document.getElementsByClassName('feeditemtext');
            for (var i=0; i<elements.length; i++) {                
                feeds += elements[i].innerHTML + "         ";
            }
            return feeds;
        }        
        
        var feedItems = getFeedItemBody();

        scrollButtonText();       
                
        function scrollButtonText() {                   
            sforce.console.setCustomConsoleComponentButtonText(feedItems, function() {
                sforce.console.scrollCustomConsoleComponentButtonText(150, 5, true, function(result){});            
            });
         }
       
    </script>

</apex:page>

Thank you!
 
Hello,

I'm tryin to execute a method using the anonymous execute functionality, however the method that i'm trying to execute it is using a object as a paramter, and when i try to pass an Id de execution gives me an error saying that the param type for string is invalid.

className.doTransfer(transfer__c pTransf)

So I want to know how can I execute this method.

Thank you!