+ Start a Discussion
Hemant Gothwal 1Hemant Gothwal 1 
My issue seems to be very strange. I have created this process and when I test it, it is updating the sales price to deposit amount as said in the requirement. But when the chellenge is checked it gives me error message:
Challenge Not yet complete... here's what's wrong: 
The Fulfillment Cancellation Automation process does not appear to be working properly. Make sure that a cancelled Fulfillment updates the Adventure Package correctly.


Chose the fullfillment object
have proper conditions:
User-added image

and update the adventure package
User-added image

I tested it and it seems to be updating the sales price to the diposit amount correctly:
User-added image

but still on checking Chellenge I get the error:
User-added image

completedly stumped!!! please let me know if anybody faced the same issue. any help.
 
Best Answer chosen by Hemant Gothwal 1
NagendraNagendra (Salesforce Developers) 
Hi Hemant Gothwal,

Please doble check the steps. Especially Field Update Filter condition : 
Line Item ID  equals Formula [FullFillment__c].AdventurePackageId__c.

Also check debug logs when you check the challenge.
Refer this post to check what the trialhead doing to test our work in background :
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kIudIAE

So you can check where their test is failing.

Please make sure to mark this post as solved if it helps you.

Best Regards,
Nagendra.P
Christian Schwabe 8Christian Schwabe 8 
Hi all,

I have built a vf-page, that should show helptext in classic, lightning experience and salesforce1 but does not rendered helptext in lightning experience properly.

Question:
Does anyone know why helptext is not rendered in lightning experience?

Related article:
  • https://salesforce.stackexchange.com/questions/21412/help-text-not-appearing-when-using-apexoutputfield-with-a-custom-label

That's the way it look (currently):
Lightning experience:
User-added image
Classic:
User-added image
Salesforce1:
User-added image

Following code is used for vf-page:
<apex:page applyBodyTag="false"
    applyHtmlTag="true"
    renderAs="html"
    docType="html-5.0"
    showHeader="true"
    sidebar="true"
    standardStylesheets="true"
    title="{!title}"
    controller="SepaTransactionController"
    tabStyle="SepaSearchTransaction__tab"
    lightningStylesheets="true" 
>

<apex:form >
        <apex:pageMessages id="pageMessage" escape="false"/>

        <apex:pageBlock title="{!title}" mode="detail" id="pageBlockSetionItemSearchCriteria">

            <apex:pageBlockSection title="{!$Label.Input}" columns="{!IF(OR($User.UIThemeDisplayed = 'Theme3', $User.UIThemeDisplayed = 'Theme4d'), 2, 1)}" id="pageBlockSearchCriteria">
                <apex:PageBlockSectionItem helpText="{!$Label.HelpGASATIds}">
                    <apex:outputLabel value="{!transactionPluralName} Ids" for="idsId"/>
                    <apex:inputText id="idsId" value="{!transactionIds}"/>
                </apex:PageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
Best Answer chosen by Christian Schwabe 8
Christian Schwabe 8Christian Schwabe 8
Hello Sarvani,

thanks for your reponse!
I found and read this article before, but thought that it only describe the missing helptext for fieldsets.

Encouraged by your statement, I went on another search and came across the following example: http://www.codebycody.com/2014/08/super-simple-help-text.html
I only made small adjustments to it and the result now looks like this:
User-added image

That looks like the original helpText in lightning. I like it and it stays that way now. Thank you.
 
SKTSKT 
I have a requirement to get all the Project Ids of Resource under User Detail page.

Below is my Object Schema:
Parent: Project (Field: ProjectId)
Child: Timecard (Field: Project__c, Resource_Name__c)


Now, if the Resource Name under timecard matches with User Name, the Project Ids from that timecard should be stored on User detail page separated by a semicolon.
Below is my logic that I have achieved so far:
 
list<user> user = [SELECT  name from User where isactive = true]; 
list<string> str = new list<string>();
for(user u1 : user){
    str.add(u1.name);
}

List <Timecard__c> timecard = [
  SELECT ID,Project__c,resource_name__c  
  FROM Timecard__c 
  Where Resource_name__c = :str  and Project__c != null and Resource_Name__c != null];
            
    set<string> allProsset = new set<string>();
    for (Timecard__c timecards : timecard) {
      allProsset.add(timecards.Project__c);
    }
    list<string>allProsList = new list<string>(allProsset);
    list<User> userupdates = new list<user>();
    
    for(User us : user){
     
        us.Project_Ids__c = String.join(allProsList,';');
        userupdates.add(us);
        }
        
    update userupdates;

Now when i execute the above logic, Project Ids under User record is getting updated with some random Project IDs but not from the timecard where the User name is matching. Instead of pulling all the project Ids that the resource is working under, I am seeing some random project ids


Is there anyway that I can update user records with the exact project ids that matches resource name with user name in timecard under a project?


 
Best Answer chosen by SKT
Maharajan CMaharajan C
Then you have to use a one time batch:

Batch Class:
 
global class batchUserProjectUpdate implements Database.Batchable<sObject> {

    global Database.QueryLocator start(Database.BatchableContext BC) {

        String query = 'SELECT name from User where isactive = true';

        return Database.getQueryLocator(query);

    }


    global void execute(Database.BatchableContext BC, List<user> scope) {

        Set<string> str = new Set<string>();
		for(user u1 : scope){
			str.add(u1.name);
		}

		List <Timecard__c> timecard = [ SELECT ID,Project__c,resource_name__c  FROM Timecard__c 
									  Where Resource_name__c IN: str and Project__c != null and Resource_Name__c != null];
									  
									  
		Map<String, set<String>> usertcMap = new Map<String, set<String>> ();
		for (Timecard__c timecards : timecard) {
			if(!usertcMap.containsKey(timecards.Resource_name__c))
				usertcMap.put(timecards.Resource_name__c, new set<String>{timecards.Project__c});
			else
				usertcMap.get(timecards.Resource_name__c).add(timecards.Project__c);
		}

		list<User> userupdates = new list<user>();
		for(User us : user){ 
			if(usertcMap.containsKey(u1.name))
			{
				set<string> allProsSet = usertcMap.get(u1.name);
				list<string> allProsList = new list<string>(allProsset);
				us.Project_Ids__c = String.join(allProsList,';');
				userupdates.add(us);
			}
		}

		if(!userupdates.IsEmpty())
			update userupdates;

    }   


    global void finish(Database.BatchableContext BC) {

    }

}


To Execute the above batch :

We run the batch class based on the user count... So below the batch will pick 10 users per execution.

Run the below code in Dev Console or in Workbench.
 
Id batchJobId = Database.executeBatch(new batchUserProjectUpdate(), 10);


Thanks,
Maharajan.C
Sohan ShirodkarSohan Shirodkar 
I have used case-assignment rules to assign cases automatically to the right user/queue based on certain conditions. 

Recently I was going through Trailhead content on omni-channel and various routing mechanisms (skill based, queue based). Following statement from trailhead confuses me : "Omni-Channel always assigns cases to the right support agents, and customers are happy with customer service. ".

If we already have case-assignment rules in place, why do we need omni-channel queue based routing? How are the two things different?
Best Answer chosen by Sohan Shirodkar
SwethaSwetha (Salesforce Developers) 
HI Sohan,

A case assignment rule in Salesforce.com is really a grouping of rules that will help you automatically assign cases throughout your support organization based on criteria captured on the case records. Each assignment rule can have multiple rule entries.

In Omni-Channel, work items are automatically routed or “pushed” to agents who are assigned to the appropriate queue. Incoming work items are routed to the agent with the least amount of open work. When work items all consume 1 capacity, the agent with the lowest number of work items receives incoming work.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks
Lakshmi SLakshmi S 
Hi All,

Example Program for batch apex chaining and scheduling?
Best Answer chosen by Lakshmi S
Amit Chaudhary 8Amit Chaudhary 8
Please check below post to learn about Batch job
1) http://amitsalesforce.blogspot.com/2016/02/batch-apex-in-salesforce-test-class-for.html

Batch Apex
A Batch class allows you to define a single job that can be broken up into manageable chunks that will be processed separately.

When to use Batch Apex
One example is if you need to make a field update to every Account in your organization. If you have 10,001 Account records in your org, this is impossible without some way of breaking it up. So in the start() method, you define the query you're going to use in this batch context: 'select Id from Account'. Then the execute() method runs, but only receives a relatively short list of records (default 200). Within the execute(), everything runs in its own transactional context, which means almost all of the governor limits only apply to that block. Thus each time execute() is run, you are allowed 150 queries and 50,000 DML rows and so on. When that execute() is complete, a new one is instantiated with the next group of 200 Accounts, with a brand new set of governor limits. Finally the finish() method wraps up any loose ends as necessary, like sending a status email.

Sample Batch Apex
1) Start method is automatically called at the beginning of the apex job. This method will collect record or objects on which the operation should be performed. These record are divided into subtasks & passes those to execute method.

2) Execute Method performs operation which we want to perform on the records fetched from start method.

3) Finish method executes after all batches are processed. Use this method to send confirmation email notifications.
global class AccountUpdateBatchJob implements Database.Batchable<sObject>
{
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'SELECT Id,Name FROM Account';
       
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, List<Account> scope)
    {
        for(Account a : scope)
        {
            a.Name = a.Name + 'Updated by Batch job';
        }
        update scope;
    }
    global void finish(Database.BatchableContext BC) {
    }
}
Calling on Batch Apex

            AccountUpdateBatchJob obj = new AccountUpdateBatchJob();
            DataBase.executeBatch(obj);

Scheduler Class For Batch Apex
global class AccountUpdateBatchJobscheduled implements Schedulable 
{
    global void execute(SchedulableContext sc) 
    {
        AccountUpdateBatchJob b = new AccountUpdateBatchJob(); 
        database.executebatch(b);
    }
}

Call one Batch from Another chaining
global class otherBatchjob implements Database.Batchable<sObject>
{
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'SELECT Id,Name FROM Account';
       
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, List<Account> scope)
    {
        for(Account a : scope)
        {
            a.Name = a.Name + 'Updated by Batch job';
        }
        update scope;
    }
    global void finish(Database.BatchableContext BC) 
	{
			// Add batch job calling logic in Finish method
		    AccountUpdateBatchJob b = new AccountUpdateBatchJob(); 
			database.executebatch(b);
    }
}


Let us know if this will help you

Thanks
Amit Chaudhary
 
David NikoliDavid Nikoli 
I am running a e com store and just created the website. Now my business is growing and i want to make mobile app of best japanese vegetable knives (https://toolsofchef.com/best-japanese-vegetable-knives/) my store. Is there a developer here who can tell me how much it would cost to build a mobile app?
Best Answer chosen by David Nikoli
ANUTEJANUTEJ (Salesforce Developers) 
Hi David,

Please be advised that this community is focused on Salesforce technical discussions where the forums and participants are geared toward programming troubleshooting and support. 
I would request you to not post such posts on this forum going forward.

You might want to consider posting this information on job portals for the right visibility.

Please close the thread by selected as Best Answer so that we can keep our community clean.

Regards,
Salesforce Support
Girish Reddy 52Girish Reddy 52 
Hi, I have alread created an Object but I forgot to select Add Notes and 'Attachments related list to default page layout' this checkbox & my Object is ready now. How can I select this checkbox again ? Is there any option ?
Best Answer chosen by Girish Reddy 52
AbhinavAbhinav (Salesforce Developers) 
Hi Girish ,

Setup--->ObjectManager-->SelectYourObject--->Page Layout---> Related List--> Drag 'Notes And Attachement' to layout.

If it helps mark it as best Answer.

 
Mangi S V V Satya Surya Sravan KumMangi S V V Satya Surya Sravan Kum 
Hello,  I have been trying this program since last 4 hours I'm stuck with it please some one help me 
Best Answer chosen by Mangi S V V Satya Surya Sravan Kum
Suraj Tripathi 47Suraj Tripathi 47
Hi Mangi,

Check this code:-
public class NumberTOWordConvertion {
    public static void method(){
        Date dt = Date.newInstance(2020, 6, 1);//user give any month
        
        Integer month = dt.Month(); 
        Integer year = dt.Year(); 
        Integer numberDays = Date.daysInMonth(year, month);
        Integer totalSun = 0;
        Integer totalSat = 0;
        for(Integer i=1;i<=numberDays ;i++)
        {
            Date myDate = date.newInstance(year, month, i);
            Datetime dt1 = (DateTime)myDate;
            if(String.valueOf(dt1.format('EEEE')) == 'Sunday')
            {
                totalSun = totalSun+1;  
            }
            if(String.valueOf(dt1.format('EEEE')) == 'Saturday')
            {
                totalSat = totalSat+1;  
            }
        }
        
        System.debug('totalSun -->> '+totalSun);
        System.debug('totalSat -->> '+totalSat);
    }
}

In case you find any other issue please mention. 
If you find your Solution then mark this as the best answer. 
Glenn Dailey 1Glenn Dailey 1 
The 'AccountProcessor' class did not achieve 100% code coverage via your test methods. Make sure that you chose 'Run All' tests in the Developer Console at least once before attempting to verify this challenge. I did the run all with no luck. I did notice that this is the new section that was just added and I ran into issues in the first unit too.

Create an Apex class with a method using the @future annotation that accepts a List of Account IDs and updates a custom field on the Account object with the number of contacts associated to the Account. Write unit tests that achieve 100% code coverage for the class.
Create a field on the Account object called 'Number_of_Contacts__c' of type Number. This field will hold the total number of Contacts for the Account.
Create an Apex class called 'AccountProcessor' that contains a 'countContacts' method that accepts a List of Account IDs. This method must use the @future annotation.
For each Account ID passed to the method, count the number of Contact records associated to it and update the 'Number_of_Contacts__c' field with this value.
Create an Apex test class called 'AccountProcessorTest'.
The unit tests must cover all lines of code included in the AccountProcessor class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

public class AccountProcessor
{
  @future
  public static void countContacts(Set<id> setId)
  {
      List<Account> lstAccount = [select id,Number_of_Contacts__c , (select id from contacts ) from account where id in :setId ];
      for( Account acc : lstAccount )
      {
          List<Contact> lstCont = acc.contacts ;
         
          acc.Number_of_Contacts__c = lstCont.size();
      }
      update lstAccount;
  }
}

and
@IsTest
public class AccountProcessorTest {
    public static testmethod void TestAccountProcessorTest(){
        Account a = new Account();
        a.Name = 'Test Account';
        Insert a;

        Contact cont = New Contact();
        cont.FirstName ='Bob';
        cont.LastName ='Masters';
        cont.AccountId = a.Id;
        Insert cont;
       
        set<Id> setAccId = new Set<ID>();
        setAccId.add(a.id);
 
        Test.startTest();
            AccountProcessor.countContacts(setAccId);
        Test.stopTest();
       
        Account ACC = [select Number_of_Contacts__c from Account where id = :a.id LIMIT 1];
        System.assertEquals ( Integer.valueOf(ACC.Number_of_Contacts__c) ,1);
  }
 
}
Best Answer chosen by Glenn Dailey 1
Amit Chaudhary 8Amit Chaudhary 8
I am glad that works. PLease mark best answer and close this thread so that if some one has same issue that post can help other
Anshuman ParhiAnshuman Parhi 
  1. Create custom object ‘Complaints’ with appropriate fields. It will have ‘Response Date’ field (Date/time). It will also have ‘Priority’ field (Picklist). Write a code which will auto-update Response Date field based on Priority using following mapping:             
 
PriorityResponse Date
CriticalCreation Date + 6 Business Hours
HighCreation Date + 2 Business Days
MediumCreation Date + 5 Business Days
LowCreation Date + 10 Business Days

[Response Date cannot include Saturday/ Sunday in calculation as they are not business days]

Any solution for this..
Best Answer chosen by Anshuman Parhi
CharuDuttCharuDutt
Hii Ayushman
Try Below Code
trigger ComplaintsTrigger on Complaints__c (before Update) {

    for(Complaints__c Acc:trigger.new){
         if(Acc.Priority__c == 'Critical'){
            Acc.Response_Date__c = Acc.CreatedDate.AddHours(6);
        }
        else if(Acc.Priority__c == 'High'){
            Acc.Response_Date__c = Acc.CreatedDate.AddDays(2);
        }
        else if(Acc.Priority__c == 'Medium'){
            Acc.Response_Date__c = Acc.CreatedDate.AddDays(5);
        }
        else if(Acc.Priority__c == 'Low'){
            Acc.Response_Date__c = Acc.CreatedDate.AddDays(10);
        }
       
       datetime myDate = datetime.newInstance(Acc.Response_Date__c.year(), Acc.Response_Date__c.month(), Acc.Response_Date__c.day());
       String day = myDate.format('EEEE');
         system.debug(day);
       
        if(day == 'Sunday' || day == 'Saturday'){
            Acc.priority.AddError('Error');
        }

	}
}
Please Mark It As Best Answer If It Helps
Thank You!