• brahmaji tammana
  • NEWBIE
  • 379 Points
  • Member since 2016

  • Chatter
    Feed
  • 10
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 103
    Replies
I'm new to writing Triggers this is my first one wirtten without help.  I'm not sure where I'm going wrong here but this is what I need it to do.  If the stage field is updated to Forfeit or Withdraw after action I need it to reomve all data in the fields in the trigger.  I got this up and running, but one issue.  It's basically making the fields null even when the stage isn't one of those two values.  I'm not sure where I'm going wrong with this.  Any help would be appreciated.

trigger RemoveUDF on Contact (before update) {
    for (Contact cont : Trigger.New)
    {
      If (cont.TargetX_SRMb__Student_Type__c == 'First-Time Freshman'&& (cont.TargetX_SRMb__Status__c == 'Forfeit'|| cont.TargetX_SRMb__Status__c == 'Withdraw-Stu WD After Act'))    
      {
            cont.Moravian_CA_UDEF_3A_3__c = Null;
            cont.Moravian_CA_UDEF_1A_4__c = Null;
            cont.Moravian_CA_UDEF_10A_1__c = Null;
            cont.Moravian_CA_UDEF_1A_10__c = Null;
            cont.Moravian_CA_UDEF_1A_1__c = Null;
            cont.Moravian_CA_UDEF_1A_2__c = Null;
            cont.Moravian_CA_UDEF_1A_3__c = Null;
            cont.Moravian_CA_UDEF_1A_5__c = Null;
            cont.Moravian_CA_UDEF_1A_6__c = Null;
            Cont.Moravian_CA_UDEF_1A_7__c = Null;
            Cont.Moravian_CA_UDEF_1A_8__c = Null;
            Cont.Moravian_CA_UDEF_1A_9__c = Null;
            Cont.Moravian_CA_UDEF_2A_1__c = Null;
            Cont.Moravian_CA_UDEF_2A_2__c = Null;
            Cont.Moravian_CA_UDEF_2A_3__c = Null;
            Cont.Moravian_CA_UDEF_3A_2__c = Null;
            Cont.Moravian_CA_UDEF_3A_3__c = Null;
            Cont.Moravian_CA_UDEF_3A_4__c = Null;
            Cont.Moravian_CA_UDEF_5A_1__c = Null;
            Cont.Moravian_CA_UDEF_5A_2__c = Null;
            Cont.Moravian_CA_UDEF_5A_3__c = Null;
            Cont.Moravian_CA_UDEF_5A_4__c = Null;
        }     
    }
}
Hi Team,
Please help me out to resolve following issue  "An internal server error has occurred Error ID: 1971768664-19968 (827702864)". Thanks in advance.

User-added image
Not sure if I've posted this in the correct category... We recently implemented Salesforce with the NPSP. I've noticed that somehow our Task actions have been duplicated:

User-added image
User-added image

The actions that have been duplicated are: 'Change Date', 'Change Priority', 'Change Status', 'Edit Comments'.

Any idea why this has happened and how it can be fixed? Should I simply delete the duplicate actions? Any help would be much appreciated.

Hello if i i have class how can i  print the verible int the class:

for example :

<apex:outputText value="{!discounts}"/>
 

and i get the result of :

discountsClass:[name=household, type=percent, value=0.07]
how can i get the varible inside like the name?

 

Hello everyone,

Bellow is part of a code and I would like to know if someone could tell me why I’m receiving the error "List index out of bounds: -1"  for po.Interval2__c even though po.Size__c = 4 ( if I delete line po.Interval2__c =myValues[myValues.size()-2]; code runs ok )
 
List<Integer> myValues = new List<Integer>();
            myValues.add(myValue);
            (myValues.sort());
            
          	        
            po.Interval1__c = myValues[myValues.size()-1];
            po.Interval2__c =myValues[myValues.size()-2];
            po.Size__c = myValues.size();

Thanks

Sylvio
Hello Folks ,

Please help me to clear few bacis doubts related to Governor limit - bulkfy DML 

Case 1: My code is like below

List<Account> act = [ some query and it retrns 5000 records ];
for ( account a : act)
{
a.description =' updated by script';
}
update act;

Case 2: My code is like below
List<Account> act = [ some query and it retrns 5000 records ];
List<Account> new_act = new List<Account>();

for ( account a: act)
{
a.description =' updated by script ';
new_act.add(a);
}

update new_act;

================================

Ok so my question is as my quesry is retriving 5000 records and I want to update these records ,so I needto Bultyfly my dml so it will not breach the govornor limit . so in to achive this , as per my understading , both of these approches should do the same work , i.e , as I worte the Update outside the loop, hence it will execute only once ( though the for loop goes for 5000 times ) and update all these 5000 records. 

So is this correct ? can someone clafiry please .

Thanks,
Tanoy
Hello,

Is it possible to detect the profile name of user directly in VF page without querying inside apex ?

tanks for suggestion !
Hi All,

I am trying to create a Visualforce page that contains two PageBlockTables. One of these tables contains equipment items with relevant information. On each row of this table, there is a "Quantity" input box. The other table is underneath that one, and it starts out with no data. I would like to be able to type in a quantity in the input boxes, then click a button under the table labeled "Add to Order". When this button is clicked, I would like for the equipment with input quantities to show up on the second table, where I will then place a "Save" button to save this particular selection of equipment and quantities as an iteration of a custom object. Any help for a starting point would be greatly appreciated, even if it's just a point in the right direction.

Thanks in advance!
Good Morning, 

Below is a trigger I wrote to sum the number of activities on a given opportunity. I am getting an error at line 20, unexpected token: 'Map'.

Any ideas on what I could be doing wrong? This is the first trigger I have written so go easy on me :)

trigger CountTasks on Opportunity (before update) {
     
    // Put all Opportunities into a Set
    Set<string> allOppIDs = new Set<string>();
    for (Opportunity newOpp : Trigger.new) {
        allOppIDs.add(newOpp.ID);
        System.debug('ID added: ' + newOpp.ID);
    }
     
    //Query All Tasks to find Tasks with matching IDs
    List<task> allTasks = [SELECT Id, Status, WhatID from Task
                           WHERE WhatID IN :allOppIDs];
    System.debug('allTasks is ' + allTasks.size());
    // Create a Map that lets you search for Tasks by their ID - faster than SOQL each time
     
    List<string> TaskArray = new List<string>(); //All Tasks
    List<string> IDToTaskMapOpen = new List<string>(); //usedforOpenTasks
    List<string> IDToTaskMapClosed = new List<string>(); //usedforClosedTasks
     
    Map<string nteger=""> elCountAll = new Map<string nteger="">(); //Count of All Tasks
    Map<string nteger=""> elCountOpen = new Map<string nteger="">(); //Count of Open Tasks
    Map<string nteger=""> elCountClosed = new Map<string nteger="">(); //Count of Closed Tasks
     
     
     
    for (Task u : allTasks) {
        if (u.Status != 'Completed' ) {
            IDToTaskMapOpen.add(u.WhatID);
            System.debug('Added Open Task');
             
        }
        if (u.Status == 'Completed') {
            System.debug('Added Completed Task');
            IDToTaskMapClosed.add(u.WhatID);
             
        }
        TaskArray.add(u.WhatID);
    } 
     
    System.debug(allTasks.size());
    System.debug(IDToTaskMapOpen.size());
    System.debug(IDToTaskMapClosed.size());
     
     
     
    // Get the matching tasks from the Map - and count Status
    //Start with our Opportunity
    for (Opportunity newOpp : Trigger.new) {
         
        //Count all Tasks
        for(String key : TaskArray)
        {
            if(!elCountAll.containsKey(key)){
                elCountAll.put(key,0);
            }
            Integer currentInt=elCountAll.get(key)+1;
            elCountAll.put(key,currentInt);
        }
         
         
        //Count all Open Tasks
        for(String key1 : IDToTaskMapOpen)
        {
            if(!elCountOpen.containsKey(key1)){
                elCountOpen.put(key1,0);
            }
            Integer currentInt1=elCountOpen.get(key1)+1;
            elCountOpen.put(key1,currentInt1);
        }
         
        //Count all Closed Tasks
        for(String key2 : IDToTaskMapClosed)
        {
            if(!elCountClosed.containsKey(key2)){
                elCountClosed.put(key2,0);
            }
            Integer currentInt2=elCountClosed.get(key2)+1;
            elCountClosed.put(key2,currentInt2);
        }
         
         
        //Finally update the record
        //All Activities
        newOpp.AllTasks__c = elCountAll.get(newOpp.ID);
         
        //Open & Not Started Tasks
        newOpp.Open_Tasks__c = elCountOpen.get(newOpp.ID);
         
        //Closed Tasks
        newOpp.Closed_Tasks__c = elCountClosed.get(newOpp.ID);
         
    }
     
     
}
</string></string></string></string></string></string></string></string></string></string></string></string></task></string></string>
Is it possible to customize the buttons in the Embedded Chat? We would like to connect a web form (web to case) to the embedded chat through one of the available buttons. This doesn't seem possible through configuration and we would like to know how this could be developed.

Analysis:
We inspected from the browser console that the embedded chat window is using EmbeddedServiceUtil and we are unable to make changes to this js file as we can’t locate it in our developer console. Would it be possible to make changes to this js file or which other options we have?
Can you someone help me to call a controller from aura:iteration tag ?
<aura:iteration items="{!v.contacts}" var="c">
        <a href="{! '/'+c.Id}" >
        <p> {!c.Name} ( {!c.Birthdate} ) </p>    
        </a>
       <h6> {!c.Email}</h6>
        <ui:inputText label="Greetings !!" value="{!v.greeting}" />
        <ui:button label="Post" press="{!c.gsendmail}" />   
        <button type="button" onclick="{!c.gsendmail}" >Send</button>
    </aura:iteration>

I am able to call from outside aura:iteration but i am not able to do the same within aura:iteration. Basically for all the iteration items i need to put one input text and Post button to send an email by taking the input text field value.

Thanks
Brahma
Is it possible to customize the buttons in the Embedded Chat? We would like to connect a web form (web to case) to the embedded chat through one of the available buttons. This doesn't seem possible through configuration and we would like to know how this could be developed.

Analysis:
We inspected from the browser console that the embedded chat window is using EmbeddedServiceUtil and we are unable to make changes to this js file as we can’t locate it in our developer console. Would it be possible to make changes to this js file or which other options we have?
Is it possible to customize the buttons in the Embedded Chat? We would like to connect a web form (web to case) to the embedded chat through one of the available buttons. This doesn't seem possible through configuration and we would like to know how this could be developed.

Analysis:
We inspected from the browser console that the embedded chat window is using EmbeddedServiceUtil and we are unable to make changes to this js file as we can’t locate it in our developer console. Would it be possible to make changes to this js file or which other options we have?
Hi Expert,

i want to open a popup box that should be open when user logged In. when user  closed this then this will not reopen for this session. if user logged in again then popup should be open .

what i have done:

create a lightning component and added this on home page layout. but this popup open again and again when home page refresh. 

So can you please suggest what should i use sothat model popup should open once for current session.

Regards
Mukesh
I'm new to writing Triggers this is my first one wirtten without help.  I'm not sure where I'm going wrong here but this is what I need it to do.  If the stage field is updated to Forfeit or Withdraw after action I need it to reomve all data in the fields in the trigger.  I got this up and running, but one issue.  It's basically making the fields null even when the stage isn't one of those two values.  I'm not sure where I'm going wrong with this.  Any help would be appreciated.

trigger RemoveUDF on Contact (before update) {
    for (Contact cont : Trigger.New)
    {
      If (cont.TargetX_SRMb__Student_Type__c == 'First-Time Freshman'&& (cont.TargetX_SRMb__Status__c == 'Forfeit'|| cont.TargetX_SRMb__Status__c == 'Withdraw-Stu WD After Act'))    
      {
            cont.Moravian_CA_UDEF_3A_3__c = Null;
            cont.Moravian_CA_UDEF_1A_4__c = Null;
            cont.Moravian_CA_UDEF_10A_1__c = Null;
            cont.Moravian_CA_UDEF_1A_10__c = Null;
            cont.Moravian_CA_UDEF_1A_1__c = Null;
            cont.Moravian_CA_UDEF_1A_2__c = Null;
            cont.Moravian_CA_UDEF_1A_3__c = Null;
            cont.Moravian_CA_UDEF_1A_5__c = Null;
            cont.Moravian_CA_UDEF_1A_6__c = Null;
            Cont.Moravian_CA_UDEF_1A_7__c = Null;
            Cont.Moravian_CA_UDEF_1A_8__c = Null;
            Cont.Moravian_CA_UDEF_1A_9__c = Null;
            Cont.Moravian_CA_UDEF_2A_1__c = Null;
            Cont.Moravian_CA_UDEF_2A_2__c = Null;
            Cont.Moravian_CA_UDEF_2A_3__c = Null;
            Cont.Moravian_CA_UDEF_3A_2__c = Null;
            Cont.Moravian_CA_UDEF_3A_3__c = Null;
            Cont.Moravian_CA_UDEF_3A_4__c = Null;
            Cont.Moravian_CA_UDEF_5A_1__c = Null;
            Cont.Moravian_CA_UDEF_5A_2__c = Null;
            Cont.Moravian_CA_UDEF_5A_3__c = Null;
            Cont.Moravian_CA_UDEF_5A_4__c = Null;
        }     
    }
}
I have a simple lightining component with following code
Component:
aura:component controller="CheckVATService" implements="force:hasRecordId,force:lightningQuickActionWithoutHeader">
	<aura:attribute name="account" type="Object"/>
    <aura:attribute name="simpleAccount" type="Object"/>
    <aura:attribute name="accountError" type="String"/>
    	
	<force:recordData aura:id="accountRecordLoader"
        recordId="{!v.recordId}"
        fields="VAT_Number__c"
        targetRecord="{!v.account}"
        targetFields="{!v.simpleAccount}"
        targetError="{!v.accountError}"
    />
	<aura:handler name="render" value="{!this}" action="{!c.handleClick}"/>
</aura:component>
Controller .js
({
	handleClick : function(component, event, helper) 
	{
		if (component.get("v.simpleAccount.VAT_Number__c") == null)
		{
			$A.get("e.force:closeQuickAction").fire();
			var resultsToast = $A.get("e.force:showToast");
			resultsToast.setParams({
        	   "title": "VAT Number",
        	   "message": "VAT Number is empty!",
        	   "type": "error",
        	   "key": "error"
			});
			resultsToast.fire();
		}else{
			var action = component.get("c.CallCheckVATService");
			action.setParams(
				{
			        VATNumber: component.get("v.simpleAccount.VAT_Number__c")
				}
			);
		
		    action.setCallback(this, function(a) 
		    {
		        if (a.getState() === "SUCCESS") 
		        {
		           if (a.getReturnValue())
		           {
		        	   $A.get("e.force:closeQuickAction").fire();
			           var resultsToast = $A.get("e.force:showToast");
			           resultsToast.setParams({
			        	   "title": "VAT Number",
			        	   "message": "VAT Number is valid",
			        	   "type": "success",
			        	   "key": "success"
			           });
			           resultsToast.fire();
			       }else{
			    	   $A.get("e.force:closeQuickAction").fire();
			           var resultsToast = $A.get("e.force:showToast");
			           resultsToast.setParams({
			        	   "title": "VAT Number",
			        	   "message": "VAT Number is invalid",
			        	   "type": "error",
			        	   "key": "error"
			           });
			           resultsToast.fire();
			       }
			        
		        } else if (a.getState() === "ERROR") {
		            $A.log("Errors", a.getError());
		        }
		    });
		    $A.enqueueAction(action);
	    }	    
	    
    
	}
})

When I have a value in VAT Number field, the logic is fine, it only shows once a toast message (whether it is valid or not).

But when I added the logic to check for empty VAT Number the toast fires twice.
Any ideas why?

component :
<aura:component >
<aura:attribute name="newExpense" type="Expense__c"
     default="{ 'sobjectType': 'Expense__c',
                    'Name': '',
                    'Amount__c': 0,
                    'Client__c': '',
                    'Date__c': '',
                    'Reimbursed__c': false }"/>
    <!-- PAGE HEADER -->
    <lightning:layout class="slds-page-header slds-page-header--object-home">
        <lightning:layoutItem >
            <lightning:icon iconName="standard:scan_card" alternativeText="My Expenses"/>
        </lightning:layoutItem>
        <lightning:layoutItem padding="horizontal-small">
            <div class="page-section page-header">
                <h1 class="slds-text-heading--label">Expenses</h1>
                <h2 class="slds-text-heading--medium">My Expenses</h2>
            </div>
        </lightning:layoutItem>
    </lightning:layout>
    <!-- / PAGE HEADER -->

    <!-- NEW EXPENSE FORM -->
    <lightning:layout >
        <lightning:layoutItem padding="around-small" size="6">

       <!-- CREATE NEW EXPENSE -->
            <div aria-labelledby="newexpenseform">
            
                <!-- BOXED AREA -->
                <fieldset class="slds-box slds-theme--default slds-container--small">
            
                <legend id="newexpenseform" class="slds-text-heading--small 
                  slds-p-vertical--medium">
                  Add Expense
                </legend>
            
                <!-- CREATE NEW EXPENSE FORM -->
                <form class="slds-form--stacked">          
                    <lightning:input aura:id="expenseform" label="Expense Name"
                                     name="expensename"
                                     value="{!v.newExpense.Name}"
                                     required="true"/> 
                    <lightning:input type="number" aura:id="expenseform" label="Amount"
                                     name="expenseamount"
                                     min="0.1"
                                     formatter="currency"
                                     step="0.01"
                                     value="{!v.newExpense.Amount__c}"
                                     messageWhenRangeUnderflow="Enter an amount that's at least $0.10."/>
                    <lightning:input aura:id="expenseform" label="Client"
                                     name="expenseclient"
                                     value="{!v.newExpense.Client__c}"
                                     placeholder="ABC Co."/>
                    <lightning:input type="date" aura:id="expenseform" label="Expense Date"
                                     name="expensedate"
                                     value="{!v.newExpense.Date__c}"/>
                    <lightning:input type="checkbox" aura:id="expenseform" label="Reimbursed?"  
                                     name="expreimbursed"
                                     checked="{!v.newExpense.Reimbursed__c}"/>
                    <lightning:button label="Create Expense" 
                                      class="slds-m-top--medium"
                                      variant="brand"
                                      onclick="{!c.clickCreate}"/>
                </form>
                <!-- / CREATE NEW EXPENSE FORM -->
            
              </fieldset>
              <!-- / BOXED AREA -->
            
            </div>
            <!-- / CREATE NEW EXPENSE -->

        </lightning:layoutItem>
    </lightning:layout>
    <!-- / NEW EXPENSE FORM -->
<c:expensesList expenses="{!v.expenses}"/>

</aura:component>

controller:
({
    clickCreate: function(component, event, helper) {
        var validExpense = component.find('expenseform').reduce(function (validSoFar, inputCmp) {
            // Displays error messages for invalid fields
            inputCmp.showHelpMessageIfInvalid();
            return validSoFar && inputCmp.get('v.validity').valid;
        }, true);
        // If we pass error checking, do some real work
        if(validExpense){
            // Create the new expense
            var newExpense = component.get("v.newExpense");
            console.log("Create expense: " + JSON.stringify(newExpense));
            helper.createExpense(component, newExpense);
        }
    }
})

Helper:
({
    createExpense: function(component, expense) {
        var theExpenses = component.get("v.expenses");
 
        // Copy the expense to a new object
        // THIS IS A DISGUSTING, TEMPORARY HACK
               
        console.log("Expenses before 'create': " + JSON.stringify(theExpenses));
        theExpenses.push(newExpense);
        component.set("v.expenses", theExpenses);
        console.log("Expenses after 'create': " + JSON.stringify(theExpenses));
        
    }
})

 
I tried to log into my trailhead Salesforce Mobile app, but it says it can't find a username that matches what I entered. I verified with my user in my account that i am using the correct user nam. 
hii,
   Am getting this error while creating suggestion box,but all fields types are correct only,don't know why its throwing this error
  Please help me to solve this.

Thanks in advance
Hi Team,
Please help me out to resolve following issue  "An internal server error has occurred Error ID: 1971768664-19968 (827702864)". Thanks in advance.

User-added image
Hi All,

Can anyone, please help on the same..
not a code required, can u please share the logic.. so that i can work on same as i am new and learning triggers.

Thanks & Regards
Pranav Shah
Hi,

I building some functionality in a Lightning Out app and receive this error when using force:recordData with a custom object:

"You don't have access to this record. Ask your administrator for help or to request access."

Is force:recordData available to use in Lightning Out?

Thanks
  • November 09, 2017
  • Like
  • 0
Hi ,

I have a requirement to disable anchor tag/hyperlink from a column in table if value of that column is 0. 
The table is dynamic and data in the table is fetched from apex controller.
Any ideas?
Not sure if I've posted this in the correct category... We recently implemented Salesforce with the NPSP. I've noticed that somehow our Task actions have been duplicated:

User-added image
User-added image

The actions that have been duplicated are: 'Change Date', 'Change Priority', 'Change Status', 'Edit Comments'.

Any idea why this has happened and how it can be fixed? Should I simply delete the duplicate actions? Any help would be much appreciated.
Using Lightning and have the need to display a modal lightning component when a user change the lead status throught the Path using the "Mark Status Complete".  Can't think of a way to handle this.  
force:hasRecordId for the case quick action is not working. any ideas please
I'm trying to get below lightning component into a own custom component.

User-added image

Seems not exposed to embed, just tried below and no luck.
 
<c:recordDetail recordId="{!v.contactId}"/>

No COMPONENT named markup://c:recordDetail found :

Any help on achieving this, so that it will show up default layout set up for the profile of current user.
I installed Developer Hub Trial Org 64-bit Windows option.
I created a trial project with: 
     sfdx force:project:create -n geolocation

But, when I try to create the scratch org with:
      sfdx force:org:create -s -f config/project-scratch-def.json -a GeoAppScratch
I get this:
     ERROR running force:org:create: You do  not have access to the [scratchorgiinfo] object

I've tried several suggested fixes that I found when I searched for the above error. None has resolved the issue for me.
I'd like to modify a validation rule that would prevent a user from changing or deleting the contents of a field after data has been entered.

This formulat allows you to do just that but, if I create a record, with no data in the field, save it but return later to enter data into the field, the record errros out, not allowing me to save the record.  

Does anyone know how I could modify this to allow users to create a record and if the field is left blank on save, can enter a value later? But if a user enters data into the field on create new, they should not be able to modify the field later. If they try to modify the field data or delete the field data and try to save it, it should error out. 

Here is my number field type VR:
 
IF(ISNULL( PRIORVALUE( Quote_Number_P4__c )),FALSE,ISCHANGED( Quote_Number_P4__c ) )



Thanks,
Nick
 
Hi,
i created a tool tip componet i used may place but i want change the help text position please help me