• Mark Stven
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 27
    Replies
Friends, who loves to play games at their leisure? I've only recently started to get involved in this. I found a cool casino site https://betsofa.life Where there are new and interesting slot machines. Who loves excitement and wants to try their luck, then I advise you to look at this site.
trigger AccountIndustryAnnualRevenue on Account (before insert , before update) {
    List<Account> AccList = new List<Account>();
    for(Account Acc : Trigger.new) {
        If((Acc.Industry == 'Chemicals') && (Acc.AnnualRevenue <= 1200)){
           AccList.add(Acc);
        }    
        If(AccList.size() > 0) {
          Acc.addError ('When Industry is ‘Chemical’, annual revenue cannot be less than 1200'); // logic is incorrect. 
          
        }   
    }
}
  • March 06, 2021
  • Like
  • 0
Hello,

I want to create a custom button which will give me a pdf document. Fields will come from various objects (not from 1 object...) . Is there a step by step guide or video tutorial?
I have created custom multipicklist jQuery. In the multipicklist I have shown the contact names. Whenever I select the contact names, it is showing contact names in the label. It is also counting no.of contacts I have selected.
Activity Objective==> Wherever you see Activity Objective in the VFP, I have added the codes for the multi-picklist.
ISSUE: whenever I select the contact names (either 1 or more than 1) from the multi-picklist and click on save. It will save the record, but in the name field in the Task object will be blank. If I have selected 1 0r more than 1 contact names, it will create single record in the Task object and the name field will be blank.
REQUIREMENT: Now I want that, how many contact names I have selected from the multi-picklist. That many records will be created in the Task Object.
Already in the controller, record creation code is written. It is checking the contact name isChecked=true, then it will create the record.
In my code, it is taking isChecked=false. So it is not able to creat
<apex:page standardController="Task" id="thePageId" extensions="NewTaskCtrl" tabStyle="Task" action="{!loadNewTask}">
    <apex:outPutPanel id="myMSG">
        <apex:pageMessages id="msg" />
    </apex:outPutPanel>  
    <apex:slds />
    <apex:form id="newTaskPage">
             <!-- CDN links for the multiple picklist  -->
                <meta charset="utf-8" />
                <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
                <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
                <link href="https://www.jqueryscript.net/css/jquerysctipttop.css?v3" rel="stylesheet" type="text/css" />
                <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"/>
                <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>                
                <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
                <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
                <script src="https://cdn.jsdelivr.net/npm/@dashboardcode/bsmultiselect@0.5.40/dist/js/BsMultiSelect.min.js"></script>              
                <!-- / Activity Objective - New picklist code-->

                <apex:actionFunction action="{!filterFields}" name="filterFields" reRender="myMSG,taskInfo" >
                    <apex:param value="" name="tType" />
                </apex:actionFunction>
                <apex:sectionHeader title="Task" subtitle="New Task"/>
                <apex:inputHidden value="{!inputValue}" id="theHiddenInput"/>
                <div class="slds-card">
                    <div class="slds-card__header slds-grid slds-border_bottom slds-p-bottom_small" style="background-color: #fafaf9;">
                        <div class="slds-media slds-media_center slds-has-flexi-truncate">
                            <div class="slds-media__body">
                                <h2 class="slds-card__header-title slds-text-heading_small">
                                    Task Edit
                                </h2>
                            </div>
                            <div class="slds-no-flex">
                                <apex:commandButton action="{!performSave}" title="Save" value="Save" styleClass="slds-button slds-button_brand"/>
                                <apex:commandButton action="{!cancel}" title="Cancel" value="Cancel" styleClass="slds-button slds-button_neutral"/>
                            </div>
                        </div>
                    </div>
                    <div class="slds-card__body slds-p-horizontal_small">
                        <div class="slds-m-bottom_small slds-p-around_xx-small" style="background-color: #fafaf9;"><strong>Related To</strong></div> 
                        <div class="slds-form slds-form_horizontal">
                            <div>
                                <div style="max-width: 600px;">
                                    <apex:outputPanel styleClass="relatedToSection">
                                        <div class="slds-form-element">
                                            <apex:outputLabel value="Account" styleClass="slds-form-element__label"/>
                                            <div class="slds-form-element__control slds-m-top_xxx-small">
                                                <apex:outputField value="{!taskObjectParent.WhatId}" title="This will contain Related Account" label="Account" />
                                            </div>
                                        </div>

                                        <apex:pageBlock id="OfficeContactList">
                                            <!--  rendered="{!IF((taskObjectParent.Id = null),true,false)}"  -->
                                            <apex:outputPanel style="display:none" styleclass="taskContactMultiList">


                                                <div class="slds-form-element">
                                                    <apex:outputLabel value="Select Contact to create task" styleClass="slds-form-element__label" id="con12"/>
                                                    <div class="slds-form-element__control"  style="padding-right: 82px;">
                                                        <!-- Activity Objective  -->
                                                        <!-- Show the multiple picklist values and binding-->
                                                        <div class="container">
                                                            <select name="contactNames" id="example" class="form-control" multiple="multiple" onChange="countSelectedCheckbox()">
                                                                <apex:repeat value="{!avaiableContactlList}" var="con" id="conTable">
                                                                    <option value="{!con.isChecked}" id="opt">{!con.Name}</option> <!---value is changed -->
                                                                </apex:repeat>
                                                            </select>    
                                                        </div>
                                                        <!-- / Activity Objective -->

                                                        Total Number of Selected record :<span style="font-weight:bold" id="selContactSize">0</span>
                                                    </div>
                                                </div>

                                            </apex:outputPanel>

                                        </apex:pageBlock>     

                                    <div class="slds-form-element">
                                        <apex:outputLabel value="Topics Discussed" styleClass="slds-form-element__label"/>
                                        <apex:outputPanel id="refreshing">
                                            <div class="slds-form-element__control"  style="padding-right: 82px;">
                                                <div class="slds-scrollable_y slds-m-top_x-small slds-m-bottom_small slds-p-around_x-small" style="max-height: 90px; border: 1px solid #dddbda; border-radius: .25rem;">
                                                    <table>

                                                        <apex:repeat value="{!avaiableTopicList}" var="topic">
                                                            <tr>
                                                                <td width="20" class="slds-p-bottom_x-small">
                                                                    <span class="slds-checkbox slds-checkbox_standalone">
                                                                        <apex:inputCheckbox value="{!topic.isChecked}" onclick="selectAllCheckboxes('topicCheckBoxId')"  id="topicCheckBoxId"/>
                                                                        <span class="slds-checkbox_faux"></span>
                                                                    </span>
                                                                </td>
                                                                <td class="slds-p-bottom_x-small">
                                                                    <label>
                                                                        {!topic.Name}
                                                                    </label>
                                                                </td>
                                                            </tr>
                                                        </apex:repeat> 
                                                    </table>

                                                </div>
                                                Total Number of Selected record :<span style="font-weight:bold" id="selTopicSize">{!totalAvaiableTopic}</span> 
                                            </div>
                                        </apex:outputPanel>
                                    </div>

                                </div>
                            </div>


                        </div> 

                    </div>
                    <div class="slds-card__footer slds-text-align_right">
                        <apex:commandButton action="{!performSave}" title="Save" value="Save" styleClass="slds-button slds-button_brand"/>
                        <apex:commandButton action="{!cancel}" title="Cancel" value="Cancel" styleClass="slds-button slds-button_neutral"/>  
                    </div>
                </div>
                <script>
                function setFocusOnLoad() {}

                function toggleComponent(taskType,componentToToggle,taskId){
                    console.log('taskId : '+taskId);
                    //filterFields();
                    if(taskId == 'NULL' || taskId == ''){
                        var contactComponent = document.getElementsByClassName(componentToToggle)[0];
                        var selectedValue = taskType.value;
                        console.log(componentToToggle);
                        if(selectedValue == 'Physician-to-Physician Visit' || selectedValue == 'Sports Medicine' ){
                            contactComponent.style.display ='block';

                        }else{
                            contactComponent.style.display ='none';
                        }
                    }else{
                        var contactComponent = document.getElementsByClassName(componentToToggle)[0];
                        var selectedValue = taskType.value;
                        console.log(componentToToggle);
                        var oldTaskType =  String(document.getElementById('thePageId:newTaskPage:theHiddenInput').value);

                        if((oldTaskType != 'Physician-to-Physician Visit' && selectedValue == 'Physician-to-Physician Visit') || (oldTaskType != 'Sports Medicine' && selectedValue == 'Sports Medicine')){
                            contactComponent.style.display ='block';

                        }else{ 
                            contactComponent.style.display ='none';
                        }
                    }
                    //alert(taskType.value);
                    filterFields(taskType.value);
                }

                function selectAllCheckboxes(receivedInputID){
                    var inputCheckBox = document.getElementsByTagName("input");
                    var totalCount = 0;
                    for(var i=0; i<inputCheckBox.length; i++){
                        if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                            if(inputCheckBox[i].checked == true){
                                //alert("inputCheckBox[i].checked==>>"+inputCheckBox[i].checked);
                                totalCount = totalCount + 1;
                            }
                        }
                    }

                    //console.log('====>' + totalCount);
                    if(receivedInputID=='contactCheckBoxId'){
                        document.getElementById('selContactSize').innerHTML = totalCount;
                    }else if(receivedInputID=='goalCheckBoxId'){
                        document.getElementById('setGoalsLength').innerHTML = totalCount;
                    }else if(receivedInputID=='topicCheckBoxId'){
                        document.getElementById('selTopicSize').innerHTML = totalCount;
                    }

                }


                // Js file to show the multiple picklist.
                $("select[multiple='multiple']").bsMultiSelect();

                // code to calculate the count of selected picklist values
                **function countSelectedCheckbox(){
                    var totalCount = $("select#example>option:selected").length;
                    document.getElementById('selContactSize').innerHTML = totalCount;
                    }
                </script>
    </apex:form>
</apex:page>

e the record. Due to limitation, not able to upload whole code.

Hello,
My use case is that I am importing csv files through data import wizard to land on a custom object ("Network Statistic"), which has a lookup field to its parent object, namely "Account" (custom field called "Referral Account"). This is an insert (not upsert) import. I need the lookup field to populate for 100% of the records, and therefore if the parent account does not exist, I need my Trigger to add and insert that account, before my Network Statistic record is added. Below is some sample code that doesn't work but may be on the right track... 

trigger NetworkStatsTrigger on Network_Statistic__c (before insert) {
 Map<String,Network_Statistic__c> hospNumbers = new Map<String,Network_Statistic__c>();
 Set<String> presentHospNumber = new Set<String>();
 List<Account> accList = new List<Account>();
 for(Network_Statistic__c d : Trigger.new){
  if(d.Referral_account__c != null && d.Referral_account__r.Hospital_number__c != null){
    hospNumbers.put(d.Referral_account__r.Hospital_number__c ,d);
  }
 }
 List<Account> presentAccounts = [SELECT Id,hospital_number__c FROM Account WHERE hospital_Number__c in : hospNumbers.keySet()];
 for(Account a : presentAccounts){
     presentHospNumber.add(a.hospital_number__c);
 }
 Set<String> hospNumberToAdd = hospNumbers.keySet(); 
 hospNumberToAdd.removeAll(presentHospNumber); 
 for(String hospNum : hospNumberToAdd){
  Account a = new Account();
  a.Name = hospNumbers.get(hospNum).hospital_name__c;
  a.AccountNumber = hospNum ;
  a.hospital_number__c = hospNum ;
  accList.add(a);
 }
 insert accList;
}
 
Hello,
I would like to create a custom action to download record attachments as a zip in LightningExperience.
I created a controller and Visualforce to download attachments obtained using zippex https://github.com/pdalcol/Zippex.
public class ImageZipController {
    
  public final ParentObject__c parent {get; set;}
  private Id parentObjId;
    
  public ImageZipController(ApexPages.StandardController stdController) {
      this.order = (order__c)stdController.getRecord();
  }
  
    public PageReference downloadAttachments(){
	orderId = order.Id;

    String objectId = parentObjId;
    String docName =  'test.zip'; 
    List<Attachment> attachments = [SELECT Name, Body FROM Attachment WHERE ParentId = :objectId];
    System.debug('>>> attachments ' + attachments.size());
    Zippex sampleZip = new Zippex();
    for(Attachment file : attachments) {
      sampleZip.addFile('folder/' + file.Name, file.Body, null);
    }
    try{
      Document doc = new Document();
      doc.FolderId = UserInfo.getUserId();
      doc.Name = docName;
      doc.Body = sampleZip.getZipArchive();
      insert doc;
      System.debug('>>> doc ' + doc.Id);
      return new PageReference('/servlet/servlet.FileDownload?file=' + doc.Id);
    } catch ( Exception ex ) {
      System.debug('>>> ERROR ' + ex);
    }
    return null;
  }

}

But even small files will give errors.
Error: System.LimitException: Apex CPU time limit exceeded

I researched myself and found that using @future can avoid it, but I don't know what code to write.
I do not have enough knowledge as a developer.
Please Help me.
Hi All, I want to know if any one has done seo for salesforce classic community. How to generate the site map.I have read the help article but getting no where to statrt. Can anyone help please.
string queryStr1 = 'SELECT ID, NAME, createdBy.Name, createdDate, lastModifiedBy.Name, lastModifiedDate, '+fldAPINameMap.get(selectedField)+' FROM '+selectedObject+' WHERE '+fldAPINameMap.get(selectedField)+' like \'%'+criteria+'%\'';

the above Dynamic query  is working perfectly on single select feild but now i am having multiple fields to select then after run query according to selected fields so it is not working
 
Hi does anybody use office 365 backups at all, and can you recommend any software.

I was thinking about maybe doing a local backup. Just to clarify i mean email
I have created the following cutomer health formula field that works perfectly.

IF( ISPICKVAL( Successful_Health_Check__c ,"No" ) ,0,10 )+
IF( ISPICKVAL( Usage_at_Expected_level__c ,"No" ) ,0,25 ) + 
IF( ISPICKVAL( All_Licenses_Paid_For__c  ,"No" ) ,0,10 ) + 
IF( ISPICKVAL( NPS_Greater_Than_6__c ,"No" ) ,0,20 ) + 
IF( ISPICKVAL( Last_In_Person_Meeting_Time_Frame__c ,"3 Months" ) ,0,0 ) + 
IF( ISPICKVAL( Last_In_Person_Meeting_Time_Frame__c ,"6 Months" ) ,0,10 ) + 
IF( ISPICKVAL( Last_In_Person_Meeting_Time_Frame__c ,"12 Months" ) ,0,30 ) + 
IF( ISPICKVAL( Change_in_Management__c ,"Yes" ) ,0,5 ) +
IF( ISPICKVAL( Overdue_30_Days__c ,"Yes" ) ,0,20 ) +
IF( ISPICKVAL( Overdue_60_Days__c  ,"Yes" ) ,0,35 ) +
IF( ISPICKVAL( Level_2_Support_Tickets__c  ,"Yes" ) ,0,55 ) +
IF( ISPICKVAL( Identified_Red_Flag_Issue__c  ,"Yes" ) ,0,55 )

We are categorizing customers into 3 categories based on the score that is calcuated from this formula.

Green = 0 - 30 
Yellow = 31 - 51 
Red 51- 9999

I would like to create a formula field that indicates their status and gives a visual indicator.  I have the following formula in an opporuntiy field that works well in categorizing Opps by Stage.

IMAGE(
CASE(StageName , 
"Negotiating Price & Implementation", "/img/samples/light_green.gif",
"Qualifying", "/img/samples/light_yellow.gif",
"Closed Lost", "/img/samples/light_red.gif",
"/s.gif"),
"status color")

I am having a tough time modifying that formula to show Red, Yellow or Green based on the following scoring tiers:

Green = 0 - 30 
Yellow = 31 - 51 
Red 51- 9999

Any ideas would be most appreciated
I am having issues getting all of my code covered or at least 75% of it.

I have tested my class manually and everything seems to work properly, but when I run my test class it does not cover the code I expected it to.  I am creating a contact con1 and retrieving the Individual_Auto_ID__c is an auto generated unique custom field.  When passed to the function it should find the newly created con and return exactly 1 result since I just created that contact.  This works perfect when testing manually but not when the Test function runs it.  Am I missing something?

Test Class:
@isTest
private class myController_Test {

    static testMethod void myTestController_Test() {
        //----------------------------------------
        //TEST CLASS FOR myController
        //----------------------------------------
    
        Contact con1 = new Contact(firstname='Test', lastname='Test', email='test@aei.org');
        
        insert con1;

        string con_id = con1.Individual_Auto_ID__c;
        string field_name = 'test';
         
        //unsubscribe - good and bad values
        boolean valid = myController.unsubscribe(con_id, field_name);
}

My Controller:
global with sharing class myController {
    public static List<Contact> contacts {get; set;}

    @RemoteAction    
    global static boolean unsubscribe(string user_id, string newsletterField) {
        Boolean valid = true;
         
        contacts = [SELECT FirstName
        FROM Contact
        WHERE Individual_Auto_ID__c = :user_id];
        
        if(contacts.size() < 1) {
            valid = false;
        } else {
            //This is not being covered 
        }
            
        return valid;
    }
}

 
Dear Friends,

I have completed 11 Badges and I received two emails one with subject 'High five! Your t-shirt is on its way.' and another with subject 'Confirm your mailing address to receive your Trailhead t-shirt'. When I try to confirm my address the given link navigating to pardot account.But I don't have pardot account.Please help me...

Thanks,
Hussey
  • February 26, 2015
  • Like
  • 0

Hi,

 

I do have a doubt regarding Salesforce.com.

 

Can we develope Games in the Salesforce.com platform?

  • August 07, 2013
  • Like
  • 0

we are strugglisng for almost 2 days to accomplish the below request.

 

we have a video to post on our portal , so end user can see it on click.

we have been provided with a html code, which plays perfect, we are not sure how to embed this in visualforce or for that matter any where in salesforce, from where we can get an url and can be posted as a link.

 

Please help...

 

can i play some thing like below from salesforce

<html>
<body>

<video width="320" height="240" controls="controls" autoplay="autoplay">
  <source src="movie.ogg" type="video/ogg">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.webm" type="video/webm">
<object data="movie.mp4" width="320" height="240">
  <embed width="320" height="240" src="movie.swf">
</object>
</video>

</body>
</html>

 

  • October 22, 2012
  • Like
  • 0

is there any possibility of uploading a video file or directly a video in salesforce sandbox

 

 

Thanks In advance

Hi All,

 

As shown below the  execution of the process order is right  r not?if not so Please do the changes and let me know.

 

Validation

Apex class

Triggers

Workflows

 

Thanks

I have a formula that works as designed but need to make it work only for a specific record type.  My formula is below.  I appreciate any help provided.

 

IF ( INCLUDES ( Account.Blog_Selections__c , "used-car-values.com" ), "used-car-values.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c , "my-home-improvement.com" ), "my-home-improvement.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c, "rentals-on-vacation.com" ), "rentals-on-vacation.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c, "client’s website blog" ), "client’s website blog; ",null )

We have a webservice that sometimes gets inundated with requests from an APEX trigger we have.  So, we wrote a .NET batch program to do the requests via API through SFDC with a 45 second delay between requests.  We'd like to make that a Batch APEX, however, I can't find any way to make the APEX code pause between submittals.  I tried a loop checking on the time, but that causes 200K worth of script statements which exceeds governor limits too.

 

Does anyone have any ideas?

 

Thanx!