• Felipe Fernandes
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 19
    Replies

Hi,

 

I have a trigger that update a field in opportunity when a task related to this opportunity have the status set to completed.

Here's my trigger:

 

 

trigger TestTask on Task (after update) {
    public Id oppId;
    for(Task t:Trigger.New){
        if(t.isClosed){
            oppId = t.WhatId;
        }
    }
    List<Opportunity> opp = [select Id from Opportunity where id = :oppId];
    for(Opportunity o : opp){
        o.Tarefa__c = 'Não';
        update o;
    }
   
}

 

I have to write a text class but i'm not sure how can I test the value of the updated field. I've inserted an opportunity and a task, but I don't know how can I finish the test class.

 

 

 

 

@isTest
private class testMyTaskTrigger {
  
    public static testMethod void testTTrigger(){
        Opportunity opp = new Opportunity();
        opp.name = 'test opp 1';
        opp.StageName = 'Oferecer projeto/orçamento';
        opp.LeadSource = 'Google';
        opp.Projeto__c = 'COM';
        opp.Regiao__c = 'Baixada Santista';
        opp.Forma_de_atencimento__c = 'individual';
        opp.Garantia__c = '01 ano contra defeito de fabricação';
        opp.CloseDate = date.today();
                                
        insert opp;
        
        Task t = new Task();
        t.OwnerId = UserInfo.getUserId();
        t.Subject='Donni';
        t.Status='Not Started';
        t.Priority='Normal';
        t.Responsavel__c='Felipe';

        insert t;       

 

Any help?

 

Thanks!!

 

Hello!

 

I need help to write a test class.

How can I test this trigger? I tried to deploy the trigger but I have to do a test...

 

 

trigger productComboUpdate on OpportunityLineItem (after insert) {
    //get the Product Numbers and other fields from the OpportunityLineItem and build a list of OpportunityLineItems to update
    List<OpportunityLineItem> oliList = new List<OpportunityLineItem>();
    for(OpportunityLineItem oli : [Select Id, PricebookEntry.Product2.Number1__c, PricebookEntry.Product2.Number2__c from OpportunityLineItem where Id in : trigger.new]) {
        oli.ProductCombo__c = oli.PricebookEntry.Product2.Number1__c + oli.PricebookEntry.Product2.Number2__c; //Update the OpportunityLineItem
        oliList.add(oli);
    }
    update oliList; //Update the OpportunityLineItems with the ProductCombo__c field
}

 

 

Can someone help me with this?

Thanks!

 

i have a formula field that just make a operation like field 1 + field 2 and I wanna update other field with the result of this field...

Can i do that with workflows?

 

I’m trying to create a roll up summary of a field on 1 object, that is created by a Formula, that looks up to another object... I know the field won't appear and i'm thinking if i can do that with workflow rules...

 

Can someone help me with this?

Thanks!

I have 8 formula fields and 1 field wich plus each one of the 8 fields and give a final result. and I have other field that you can edit and put a number for example...

What I have to do: A field that is filled with the first field if the value of the first field is <> 0 or with the second field if value of the first field is = 0.

I got an error because this formula have 8000 characters. Can I do something? Workflow rules can help me? How?

Hope to hear more.
Thanks!
Felipe.

Hi!

 

I've attached a file in a opportunity and i have to display the name of this file on a visual force page.

I have informations about the opportunity in this page and i just want to display the name file.

Can someone help me with this?

Thanks!

Hello

I have a custom object related to opportunity.
What i need: When an opportunity is closed won, this opportunity is created on my custom object.

I have to use triggers to do that?

Thanks!

Hello.

I have to lock opportunities for any editing (except by administrador) when the stage is Closed Won or Closed Lost, but this rule will prevail only 3 days after the close date.
Example: If the stage is Closed Won or Closed Lost and the Close Date is 10/10, everyone can edit the opportunity until 13/10. After this date only the administrator can edit the opportunity.

I have a code but the 3 days part don't work yet.

 

AND(OR(ISPICKVAL(PRIORVALUE(StageName), "Closed Won"), ISPICKVAL(PRIORVALUE(StageName), "Closed Lost")), NOT( $User.Id = "00580000002yttt"))

 

 

thanks!

 

Hi,

I have to lock objects making them not deletable (except by administrador)
how can i do that?

someone can help me whith this?

Thanks!

Hello!

I have a page who display a table with some informations like product, quantity, price, etc.
The informations are linked with opportunities.

I have a field in my opportunities called Providers and I can add products of diferent providers in the opportunity.

What I have to do:

In my page, the column "Products" have to display only the products of the provider selected in the opportunity.

 

Page code:

 

<apex:page standardController="Opportunity" showHeader="false" renderas="pdf">


<div style="width:700px; padding-left:20px">
<div style="float:left;width:300px; padding-left:30px">
<img src='{!URLFOR($Resource.LogoDonni)}' title="logo" />
</div>
<div style="float:right;width:320px; padding-top:25px;font-size:15px">
Av. Ana Costa,138 - Vila Mathias - Santos - SP
</div>
</div>
<div style="width:700px;padding-left:5px; padding-top:50px;font-size:15px">
<div style="float:left;width:300px; font-weight:bold">

</div>
<div align="right" style="float:right;width:300px;padding-top:20px">
Santos, {!Opportunity.Data_Geracao_Proposta__c}.
</div>

<div style="padding-top:40px">
Á {!Opportunity.Nome_Contato__c}<br/>
{!Opportunity.Telefone_Contato__c}<br/>
{!Opportunity.Account.Name}<br/>
Endereço de Entrega: {!Opportunity.End_Entrega__c}<br/>
<br/>
<b> Prezado(a) Senhor(a)</b> {!Opportunity.Nome_Contato__c}<br/>
<br/>
<div style="padding-left:40px">
Conforme solicitado, segue abaixo nossa proposta para fornecimento dos itens supra citados.
</div>
</div>
<div style="float:left; padding-top:10px; width:720px">
<div>
<div align="center">
<div style="margin-top:10px; margin-bottom:15px">
<table border="1" border-color="#DDD" width="710" id="table4">
<tr>
<td width="30px" bgcolor="#CCC"><b>Item</b></td>
<td width="270px" bgcolor="#CCC"><b>Descritivo do Produto</b></td>
<td width="30px" bgcolor="#CCC"><b>Qtde.</b></td>
<td width="70px" bgcolor="#CCC"><b>Valor Unitário</b></td>
<td width="70px" bgcolor="#CCC"><b>Valor com desconto</b></td>
<td width="100px" bgcolor="#CCC"><b>Subtotal por Produto</b></td>
</tr>
<tr>
<apex:variable value="{!1}" var="rowNum"/>
<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
<tr>
<td width="40px">{!rowNum}</td>
<td width="270px">{!line.PricebookEntry.Product2.Description & "," & line.Description & "," & line.Cor_do_produto__c } </td>
<td width="40px">{!line.Quantity}</td>
<td width="60px"><apex:OutputField value="{!line.Pre_o_venda_especial__c}"/></td>
<td width="60px"><apex:OutputField value="{!line.Z4PrecoComRTComespecial__c}"/></td>
<td width="90px"><apex:OutputField value="{!line.Pre_o_tot_prod__c}"/></td>
</tr>
<apex:variable var="rowNum" value="{!rowNum + 1}"/>
</apex:repeat>
</tr>
</table> </div>
<div style="float:left; width:720px; font-weight:bold;
border-bottom-style:solid; border-bottom-color:#BBB; border-bottom-width:thin">
<div align="right" style="float:left; width:600px; height:20px; padding-bottom:10px; padding-top:27px">
<font face="Arial">Valor Total:</font>
</div>
<div style="float:left;width:120px; height:20px; padding-bottom:10px; padding-top:27px">
<apex:OutputField value="{!Opportunity.Valor_Total__c}"/>
</div>
</div>
</div>
</div>
<div style="float:left; width:700px; padding-top:20px">
<div style="font-weight:bold;">
<font color="#000080" face="Arial">Condições Comerciais e de Fornecimento</font>
</div>
<div style="margin-left:-15px; margin-top:-12px">
<ul>
<li><b>Descrição:</b> <i>{!Opportunity.Description}</i>.</li>
<li><b>Condição de Pagamento:</b> <i>{!Opportunity.Condicao_de_Pagamento__c}</i>.</li>
<li><b>Prazo de entrega:</b> <i>{!Opportunity.Prazo_de_Entrega__c}</i>.<i><apex:OutputField value="{!Opportunity.DataDeEntrega__c}"/></i> .</li>
<li><b>Garantia:</b> <i>{!Opportunity.Garantia__c}</i>.</li>
<li><b>Montagem:</b> <i>{!Opportunity.Montagem__c}</i>.</li>
<li><b>Frete:</b> <i>{!Opportunity.Frete__c}</i>.</li>
<li><b>Validade da proposta:</b> 15 dias.</li>
</ul>
<div style="float:left; width:700px; padding-top:20px">
<div>
Fico à disposição para quaisquer esclarecimentos.
<br/>
Cordialmente,
<br/>
{!$User.FirstName} {!$User.LastName} <br/>
{!$User.Title}<br/>
{!$User.Phone}<br/>
{!$User.MobilePhone}<br/>
{!$User.Email}<br/>
www.donni.com.br<br/>
Donni Comércio de Mobiliário Corporativo
</div>
</div>
</div>

</div>
</apex:page>

Can someone please help with this.

 

thanks!

Hi!

 

I have to make the "assigned to" field required based on the input of the "owner" field.

For example: if  "owner" is x, "assigned to" is required. If  "owner" is y, "assigned to" is not necessary.

 

Can someone please help with this.

 

thanks!

hi

 

I have to make certain fields required based on the input of other fields.

For example, i have two fields: "Phone" and "Mobile Phone", if phone is filled, mobile phone is not necessary. if mobile phone is filled, phone is not necessary.

Can someone please help with this.

 

thanks!

 

Hi all, 

 

I have been asked to investigate how to help our client who wants a pdf quote document with the image of the product attached to it. We have our own built in quote system for products and was wondering if there was someway using rich text html to attach an image or if there is any other way to attach an image.

 

Thanks for all your help in advance!

 

-SFNewbie

Hi,

 

I have a trigger that update a field in opportunity when a task related to this opportunity have the status set to completed.

Here's my trigger:

 

 

trigger TestTask on Task (after update) {
    public Id oppId;
    for(Task t:Trigger.New){
        if(t.isClosed){
            oppId = t.WhatId;
        }
    }
    List<Opportunity> opp = [select Id from Opportunity where id = :oppId];
    for(Opportunity o : opp){
        o.Tarefa__c = 'Não';
        update o;
    }
   
}

 

I have to write a text class but i'm not sure how can I test the value of the updated field. I've inserted an opportunity and a task, but I don't know how can I finish the test class.

 

 

 

 

@isTest
private class testMyTaskTrigger {
  
    public static testMethod void testTTrigger(){
        Opportunity opp = new Opportunity();
        opp.name = 'test opp 1';
        opp.StageName = 'Oferecer projeto/orçamento';
        opp.LeadSource = 'Google';
        opp.Projeto__c = 'COM';
        opp.Regiao__c = 'Baixada Santista';
        opp.Forma_de_atencimento__c = 'individual';
        opp.Garantia__c = '01 ano contra defeito de fabricação';
        opp.CloseDate = date.today();
                                
        insert opp;
        
        Task t = new Task();
        t.OwnerId = UserInfo.getUserId();
        t.Subject='Donni';
        t.Status='Not Started';
        t.Priority='Normal';
        t.Responsavel__c='Felipe';

        insert t;       

 

Any help?

 

Thanks!!

 

As of today, I cannot deploy change sets from my sandbox to the production site. I get emails that the upload worked but it just doesnt apper in the list of inbound change sets.  Any Infos about this issue? 

i have a formula field that just make a operation like field 1 + field 2 and I wanna update other field with the result of this field...

Can i do that with workflows?

 

I’m trying to create a roll up summary of a field on 1 object, that is created by a Formula, that looks up to another object... I know the field won't appear and i'm thinking if i can do that with workflow rules...

 

Can someone help me with this?

Thanks!

I have 8 formula fields and 1 field wich plus each one of the 8 fields and give a final result. and I have other field that you can edit and put a number for example...

What I have to do: A field that is filled with the first field if the value of the first field is <> 0 or with the second field if value of the first field is = 0.

I got an error because this formula have 8000 characters. Can I do something? Workflow rules can help me? How?

Hope to hear more.
Thanks!
Felipe.

Hi!

 

I've attached a file in a opportunity and i have to display the name of this file on a visual force page.

I have informations about the opportunity in this page and i just want to display the name file.

Can someone help me with this?

Thanks!

Hello

I have a custom object related to opportunity.
What i need: When an opportunity is closed won, this opportunity is created on my custom object.

I have to use triggers to do that?

Thanks!

Hello.

I have to lock opportunities for any editing (except by administrador) when the stage is Closed Won or Closed Lost, but this rule will prevail only 3 days after the close date.
Example: If the stage is Closed Won or Closed Lost and the Close Date is 10/10, everyone can edit the opportunity until 13/10. After this date only the administrator can edit the opportunity.

I have a code but the 3 days part don't work yet.

 

AND(OR(ISPICKVAL(PRIORVALUE(StageName), "Closed Won"), ISPICKVAL(PRIORVALUE(StageName), "Closed Lost")), NOT( $User.Id = "00580000002yttt"))

 

 

thanks!

 

Hi!

 

I have to make the "assigned to" field required based on the input of the "owner" field.

For example: if  "owner" is x, "assigned to" is required. If  "owner" is y, "assigned to" is not necessary.

 

Can someone please help with this.

 

thanks!

hi

 

I have to make certain fields required based on the input of other fields.

For example, i have two fields: "Phone" and "Mobile Phone", if phone is filled, mobile phone is not necessary. if mobile phone is filled, phone is not necessary.

Can someone please help with this.

 

thanks!