• Debasis
  • NEWBIE
  • 413 Points
  • Member since 2016


  • Chatter
    Feed
  • 13
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 78
    Replies
Hi All,

Urgent!

I want generate a report on the Account I owned or where I am a member fo the Account team.

Please suggest solutions.

Thanks & Regards
Venkata Raja
I have red in salesforce help pages that "recordsetvar" variable can be used to access data in the record collection. But I have never seen any vf page that is using "recordsetvar" as a variable to access the data in the record collection. If it is true ,can anybody let me know any example that is using this variable to access the record collection?
How to implement map between Case and case share in salesforce ?
NOTE:if cases are shared to particular public group I don't want to re-share them to the groups, if not it should be share .Can any one please assist in validation of this using a map?
Hi All,

I have a Visual force email template on a workflow action. That will fire upon creation of Account and when it meets a check box to true and not a specific profile user. To test it I also have added the task, which creates parallalely. 
Problem I am facing is when I have added the component to the Vf email template then My Vf Template is giving me an error 
Below is the error 

Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem.

What could be the possible issue can you please help me out on this.

Below is my class for the vf component which gets account id.

public class CTBnewmyresourceemail {
    List<asset> assetlist = new List<asset>();
    Account accdetails = new Account();
    public id recId;
    public Account thisAccountId { get; set; }
    public CTBnewmyresourceemail()
    {
    recId = ApexPages.currentPage().getParameters().get('Id');
   
    accdetails = [select id from account where id=:recId limit 1];
    assetlist = [select id,accountid,description from asset where accountid =:accdetails.id];
    //return assetlist;
    }
    public List<asset> getAccount_assets() {
        return assetlist;
    }    
}

Did I made any mistake in it please suggest me.
Also In the visual force page I am trying to display the asset field value of that particular account.

THanks in advance
Prad
Hi All,

I have been facing the issue while writing the formula field taken the return type is text

here is the formula
CASE(MONTH(example__c) ,
1, "January", 
2, "February", 
3, "March", 
4, "April", 
5, "May", 
6, "June", 
7, "July", 
8, "August", 
9, "September", 
10, "October", 
11, "November", 
12, "December", 
"None" 
)

The data should be like dis 3/30/2016 in example__c, Getting error as Syntax error

Adv Thnx
Siv
  • March 30, 2016
  • Like
  • 0
Hi, 
So we have an object 'Asset' with one of fields as 'Software version number'. We want to track the software version number in Case Object and created a formula field so whenever a client generates a case the software version number will auto-populate the field. So here's the issue- When the software version changes (In asset object) as the client upgrades their software, this version number we have on Case object is also updating. Is there a way to store the old software version in the Case object even after the information in Asset object's 'software version number' field changes? Can someone help me with this? I'm sorry it's a little confusing. Can I do it using workflows and/or process builder or should I go for hardcoding?
Hi, 

So we have an object 'Asset' with one of fields as 'Software version number'. We want to track the software version number in Case Object and created a formula field so whenever a client generates a case the software version number will auto-populate the field. So here's the issue- When the software version changes (In asset object) as the client upgrades their software, this version number we have on Case object is also updating. Is there a way to store the old software version in the Case object even after the information in Asset object's 'software version number' field changes? Can someone help me with this? I'm sorry it's a little confusing. Can I do it using workflows and/or process builder or should I go for hardcoding?
Hi All,
I am newbiee to Salesforce.I have two Objects Case and a custom Object CaseReplica.On Case Replica I have a custom Field Total Cases.What I want to do is count Total number of cases created in a day  and save that number in field Total Cases in CaseReplica.One Record For a day should be created in CaseReplica.Please suggest me methods to do it.
Thanks in advance 
Can any one help me out with this error .When i compile all the classes , the system throws an error as :
Compilation Errors found:
DeleteDownloadHitOlderAYearSchedular: line 4, column 67: Constructor not defined: [DeleteDownloadHitCountBatch].<Constructor>(String)
Schedular Class is :
global class DeleteDownloadHitOlderAYearSchedular Implements Schedulable
{    
    global void execute(SchedulableContext sc) {
        DeleteDownloadHitCountBatch deleteDownloadHitCountBatch = new DeleteDownloadHitCountBatch('SELECT Id,Name FROM Download_Hit_Count__c WHERE CreatedDate < LAST_n_DAYS:365');
        Database.executeBatch(deleteDownloadHitCountBatch,100);           
    }
    
    
}
Batch Class :
global class DeleteDownloadHitCountBatch implements Database.Batchable<sObject>,Schedulable {
    
    global String query;
    
   /* global DeleteDownloadHitCountBatch(String q) {
        query = q;
    }*/
    
    global DeleteDownloadHitCountBatch() {
        query = 'SELECT Id,Name FROM Download_Hit_Count__c WHERE CreatedDate < LAST_n_DAYS:365';
    }
    
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext BC, List<sObject> scope){
        delete scope;
        //Database.emptyRecycleBin(scope);
    }
    
    global void finish(Database.BatchableContext BC){
    }
    
    //execute methode for scheduler
    global void execute(SchedulableContext sc) {
        DeleteDownloadHitCountBatch delDownloadHitCount = new DeleteDownloadHitCountBatch();
        Database.executeBatch(delDownloadHitCount ,200);           
    }
}
Any help very much appreciated.


 
Hi,

I'm working on the Trailhead - Create a workflow rule that will update a field. This is the condition:  (Case: StatusNOT EQUAL TOClosed) AND (Case: PriorityEQUALSHigh). It seems to be working for me but i'm trying out different scenarios - i wanted to see if it will not fire if my Case Status is Closed however the Status Field only has 3 picklist values: New, Working and Escalated. How can i add the Closed value to that Standard Field? Thank you so much for your help!

Best Regards,
Liz
Hello, 
I've created apex class like below:
public class newTaskForTypeController {
    TaskForTypes__c taskType;
    
    public TaskForTypes__c getTaskType(){
        if(taskType == null) return new TaskForTypes__c();
        return taskType;
    }
    //First page which will contain name 
    public PageReference step1(){
        return Page.Tasks_For_Types1;
    }
    
    //Second page which will contain Sub type name and 
    public PageReference step2(){
        return Page.Tasks_For_Types2;
    }
    
    //Cancel the operation
    public PageReference cancel(){
        //Navigate to first page
        PageReference tft1 = new ApexPages.StandardController(taskType).view();
        tft1.setRedirect(true);
        return tft1;
    }
    
    //Save method
    public PageReference save(){
        insert taskType;
        PageReference tft1 = new ApexPages.StandardController(taskType).view();
        tft1.setRedirect(true);
        return tft1;
    }
}

And VF page code is :
<apex:page standardController="newTaskForTypeController" tabStyle="TaskForTypes__c" >
    <script>
    function confirmCancel() {
        var isCancel = confirm("Are you sure you wish to cancel?");
        if (isCancel) return true; 
        return false;
    } 
    </script>
    <apex:sectionHeader title="Add New Task Assignment For Types Rule"/>
    <apex:form>
        <apex:pageBlock title="Rule Name" mode="edit">
            <apex:pageBlockButtons>
            <apex:commandButton action="{!step2}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>  
</apex:page>

Why I get this error message ==>> "newTaskForTypeController does not exist" ??
Hi Everyone,

Trying to complete the Rest Callouts challenge and getting this error on the last line: return strResponse;. Here is my code:
public class AnimalLocator {

    public static HttpResponse getAnimalNameById(Integer ID){
        Http http           = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/'+ID);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        
        String strResponse = '';
        
        if(response.getStatusCode()==200){
        
            Map<String,Object> results = (Map<String,Object>) JSON.deserializeUntyped(response.getBody());
            
            Map<String,Object> animals = (Map<String,Object>) results.get('animals');
           
            system.debug('These are the animals:');
            
            strResponse = string.valueOf(animals.get('name'));
            
        }
        return strResponse;
    }
}

Thank you!
 Trigger saves but not updating the contact field, Its Urgent,  HELP ME.....
Thanks In advance....
 

Here is my trigger :


trigger ContactCountActivity on task (after insert, after update) {

 
  map<id,integer> mcontactCount = new map<id,integer>();
  integer Count_of_Activity = 0;


if(Trigger.isinsert){
  for(task t :trigger.new) {
    if(t.whatId != null) {
      if(string.valueOf(t.whatId).left(3) == '006') {
         
         
         if(mcontactCount.containsKey(t.whatId)) {
           Count_of_Activity = mcontactCount.get(t.whatId);
         }
         Count_of_Activity = Count_of_Activity + 1;
         mcontactCount.put(t.whatid,Count_of_Activity);
      }
    }
  }
}
   

if(Trigger.isdelete){
  for(task t1 :trigger.old) {
    if(t1.whatId != null) {
     if(string.valueOf(t1.whatId).left(3) == '006') {
         
         
         if(mcontactCount.containsKey(t1.whatId)) {
           Count_of_Activity = mcontactCount.get(t1.whatId);
         }
         Count_of_Activity = Count_of_Activity - 1;
         mcontactCount.put(t1.whatid,Count_of_Activity);
      }
    }
  }
}
  if(mcontactCount.keyset().size()>0) {
    list<contact> contactToUpdate = new list<contact>([SELECT id,Count_of_Activity__c FROM contact WHERE Id IN :mcontactCount.keyset()]);
    for(contact o :contactToUpdate) {
      o.Count_of_Activity__c = mcontactCount.get(o.id);
    }
    if(contactToUpdate.size()>0) {
      update contactToUpdate;
    }
  }
 }
Hello,

please help me to get the report on how many of users have accessed case object in last 6 months.



Thanks,
Debasis
Hii,

Can anybody please help me how to upload a video from desktop to case and chatter.

Thanks in advance
Hi All,

Urgent!

I want generate a report on the Account I owned or where I am a member fo the Account team.

Please suggest solutions.

Thanks & Regards
Venkata Raja
Hi All,
​I want that in my if statement like if(Field1==true) //this is a checkbox field

     Restrict user to fill the Field2 & Field3 //this two fields are picklist field
}

All this three fields are on same object that is "Acccount:" let me know how is it possible to achieve in apex code.
Could any suggest that why i am getting this error :

Expression cannot be assigned at line -1 column -1

After saving this method 

 public static void TempAcc()
    {
       if( Account.RecordTypeId ='ParticularId')
        { 
          
               // system.debug('Account category needs to be blank when parent account is selected');
          
       }
     }




 
Hi
please let know how we will cretae image field in custom object
Any help would be appreciated
Hello,

please help me to get the report on how many of users have accessed case object in last 6 months.



Thanks,
Debasis
I have red in salesforce help pages that "recordsetvar" variable can be used to access data in the record collection. But I have never seen any vf page that is using "recordsetvar" as a variable to access the data in the record collection. If it is true ,can anybody let me know any example that is using this variable to access the record collection?
How to implement map between Case and case share in salesforce ?
NOTE:if cases are shared to particular public group I don't want to re-share them to the groups, if not it should be share .Can any one please assist in validation of this using a map?
Hi All,

I have one Account object, There are 100 Records in it, I have one field like Nation (Text Field), there are 90 records having INDIA in nation field,.....
Is it possible to count no .of records having INDIA in formula field,
This formula field need to use in reports..........


Any ideas let me share

Adv Thnx
Siv.

No relationship
  • March 31, 2016
  • Like
  • 0
Hi guys, i want to one user to see and edit the list views craeted by the other user(both are standard users). How is that possible? 
How can we achieve this functionality? Please help
Hi All,

I have a Visual force email template on a workflow action. That will fire upon creation of Account and when it meets a check box to true and not a specific profile user. To test it I also have added the task, which creates parallalely. 
Problem I am facing is when I have added the component to the Vf email template then My Vf Template is giving me an error 
Below is the error 

Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem.

What could be the possible issue can you please help me out on this.

Below is my class for the vf component which gets account id.

public class CTBnewmyresourceemail {
    List<asset> assetlist = new List<asset>();
    Account accdetails = new Account();
    public id recId;
    public Account thisAccountId { get; set; }
    public CTBnewmyresourceemail()
    {
    recId = ApexPages.currentPage().getParameters().get('Id');
   
    accdetails = [select id from account where id=:recId limit 1];
    assetlist = [select id,accountid,description from asset where accountid =:accdetails.id];
    //return assetlist;
    }
    public List<asset> getAccount_assets() {
        return assetlist;
    }    
}

Did I made any mistake in it please suggest me.
Also In the visual force page I am trying to display the asset field value of that particular account.

THanks in advance
Prad
(Total New for Programming...so pls bear with me..thx)
Q:        Create updateOlderAccounts method in Class OlderAccountsUtlity which gets the first five Account records ordered by the date created. It then updates the description field to say that this is a “heritage account,”
Sol:     
  1. Public class OlderAccountsUtility
  2. public static void updateOlderAccounts() {
  3. Account [ ] oldAccounts = [SELECT Id, Description FROM Account ORDER BY CreatedDate ASC LIMIT 5];
  4. for (Account acct : oldAccounts) {
  5. acct.Description = 'Heritage Account';  }
  6. update oldAccounts;  }
I overall get the functioning and output of the method. But have following doubts
*In Line 3 What is the syntax principle – oldAccounts Sobject of type Account is created?right?
Can’t we write this instead-?  
List<Account> oldAccounts=new List<Account>( SELECT Id, Description FROM Account ORDER BY CreatedDate ASC LIMIT 5);
Or
Account[ ] oldAccounts = new List<Account>( SELECT Id, Description FROM Account ORDER BY CreatedDate ASC LIMIT 5);
*In Line5 why to again create acct variable? Can’t we write like this?
  1. for (Account oldAccounts) {
  2. oldAccounts.Description = 'Heritage Account';  }
(Total New for Programming...so pls bear with me..thx)
 
I have a trigger that uses the account name to populate the service contract on the case. I have come across a few instances where we need to change the contact and account on the case so we delete the following off the case:
1. Service Contract
2. Account
3. Contact (then add a new contact)
Once I press save it errors with caused an unexpected exception, contact your administrator: Trigger: execution of AfterUpdate caused by: System.FinalException:Record is read-only: Trigger. Trigger line 9,column 1

The trigger is
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
trigger UpdateServiceContract on Case (before insert,before update, after update) {
  Id caseRecordTypeId = [Select id from RecordType where sObjectType = 'Case' and developerName ='Service_Desk' ].id ; 
    for (Case c : trigger.new) {
    if (c.RecordTypeID == caseRecordTypeId )
      if (c.service_contract__c == NULL){
        try{
          //c.Service_Contract__c = [select Id from ServiceContract where AccountId ='810D0000000Cfza' and Primary_Service_Contract__c = True].id;
        c.Service_Contract__c = [select Id from ServiceContract where AccountId = :c.AccountId and Primary_Service_Contract__c = True limit 1].id;
        }catch(QueryException e) {
          //No records found. Maybe you should set it to Null
      }
     }
    }
  
}

How do I amend the trigger to accomadate for the deletion of an account and service contract and a new contact is added?
Hi Guys,
How to make a field read only in visualforce page.