• Walid
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 13
    Replies
Hi,
What is the advantage of SFDX folder structure, vs the traditional SRC structure? We are currently using BitBucket + Jenkins, and all metadata changes are done using Pull Requests. We were thinking to move to SFDX, but I was wondering what is the major advantages that require the change?
Thank you
  • August 06, 2020
  • Like
  • 0
Hi there,

I would like to create a Trigger that deletes a user from a Public Group based when a Junction obkject record is also deleted. 

I have an Object Campaign that has many to many relationship to User through a Junction object called Campaign Agent. I also have a Public Group for each Campaign that has the name "Campaign ID + Agents". So, for example, if a Campaign is called My Campaign has a Campaign_Id__c field called CMP123, then the public group name is "CMP123 Agents". Whenever I add an Agent to this Campaign via the Junction object, it is automatically added to the group using Process Builder and a Time based action (after 0 hours) that calls a FLow. The Flow makes a lookup to the Campaign object, gets the Campaign Id value, then another lookup to the Group object to get the Id of the public group name, finally, it creates a GroupMember record with UserOrGroupId = User Id, and GroupId = the queried public Group Id.  

I need to do the opposite when I remove a Campaign Agent from a Campaign: I need to remove the user from the public Group when this happens.

I know  that the objct GroupMember controls which user accesses which public group using the field groupId and UserorGroupId. 

The Trigger should fire on before or after delete on the Campaign Agent object. 

Any hints to create it? 
  • December 27, 2018
  • Like
  • 0
Hi there,

I built a Visual Flow that finishes with calling an Apex method. The Flow is being launched from the Field Service Lightning mobile App, but when it tries to execute the Apex method, it fails with the error:
Error uploading: Irresolvable failure.
Invalid Action Type:
AP03c_sendToZuoraList
The Flow is a simple one that does some changes to the Work Order Line Item, and the last action is to call this method.

Here is how I am calling the method from within the flow:
User-added image

And here is the code of the method:
public class AP03c_sendToZuoraList {
    @InvocableMethod
    public static void SendToZuora(List<id> opportunityidList) {
         
        Id opportunityid = opportunityidList[0];
        
        List < zqu__Quote__c > zquotesList = [SELECT id, zqu__Opportunity__r.accountId, name, zqu__Customer_Acceptance_Date__c, zqu__Service_Activation_Date__c, zqu__SubscriptionName__c, zqu__BillCycleDay__c, zqu__ZuoraSubscriptionNumber__c
                                              FROM zqu__Quote__c
                                              WHERE zqu__Opportunity__r.id = : opportunityid];
        
        
        List<zqu.zQuoteUtil.ZBillingQuoteCollection> quotes = new List<zqu.zQuoteUtil.ZBillingQuoteCollection>();
        
        zqu.zQuoteUtil.ZBillingQuoteCollection quote = new zqu.zQuoteUtil.ZBillingQuoteCollection();
        quote.sfdcAccountId = zquotesList[0].zqu__Opportunity__r.accountId; // SFDC CRM Account ID
        quote.quoteRequests = new List<zqu.zQuoteUtil.ZBillingQuoteRequest>();
        for(zqu__Quote__c quoteToSend : zquotesList){
            zqu.zQuoteUtil.ZBillingQuoteRequest req = new zqu.zQuoteUtil.ZBillingQuoteRequest();
            req.sfdcQuoteId = quoteToSend.Id; // SFDC Quote ID
            quote.quoteRequests.add(req);
        }
        quote.zAccountId = 'new'; // Zuora Billing Account ID

        quotes.add(quote);

        List<zqu.zQuoteUtil.zBillingResult> results = zqu.zQuoteUtil.sendToZBilling(quotes);
        
        for ( zqu.zQuoteUtil.zBillingResult result : results ) {
            System.debug('Result: QuoteId = ' + result.sfdcQuoteId + ', Success = ' + result.success + ', message = ' + result.message );
        }
    }
}

Any suggestions?

Thanks!



 
  • August 24, 2018
  • Like
  • 0
Hi there,

I built a Lightning Component that is supposed to be launched from an Object Quick Action button. Unfortunately, the width of the Lightning Component is the default width of a quick action (50% I guess. How can I make the wodth of the component 100%?

I tried to add this to the cmp file, but the latest API doesn't allow the <Style> tag anymore in the cmp file:
 
<style>
       .slds-modal__container{
            max-width: 100% !important;
            width:100% !important;
       }
</style>

I also tried to add it to the CSS file:
.THIS .slds-modal__container{
           max-width: 100% !important;
           width:100% !important;
}

Did nto work either. 
Error:(1, 1) FIELD_INTEGRITY_EXCEPTION - Markup for markup://c:RegistrationForm may not contain a <style> tag: Source

How can I do that? 

Best,
Walid
  • June 06, 2018
  • Like
  • 0
Hi there,

I built a simple Lightning Component that display field of a record. The fields that I want to display in the component are all Formula fields, and I want to hide them in the Page Layout. When I hide them, the fields show as blank in the Lightning Component!! The only way to oversome this is to show the fields in the Page Layout.

Is there a way to show these fields in the Lightning Component and NOT in the Page Layout? 

Note that I am using the below to display the field in the component:
<div class="slds-col">
   <span>Deficiency<ui:outputRichText value="{!v.ConstRecord.Deficiency_Status__c}" /></span>
</div>

Thanks.
Walid 
  • May 24, 2018
  • Like
  • 0
Hi there,

I am testing a trigger with its test class:
trigger ownerManager on Opportunity (before insert, before update) {
	/*
	Write a trigger that populates an “Owner’s Manager” lookup field on opportunities 
	based on the opp owner’s (user’s) standard ManagerId field. 
	*/
	
	Set<Id> allUsersID = new Set<Id>();
	for (Opportunity so : Trigger.new) {
		//for each opportunity, get the owner's manager
		allUsersID.add(so.OwnerId);
	}

	List<User> users = new List<User>();
	users = [SELECT Id, ManagerId
			   FROM User
			  WHERE Id IN :allUsersID];

	Map<Id,Id> userToManager = new Map<Id,Id>();
	for (User us : users) {
		userToManager.put(us.Id,us.ManagerId);
	}

	for (Opportunity so : Trigger.new) {
		//for each opportunity, set the Owner's Manager Id to be the Owner's Manager from the Map
		so.Owner_s_Manager__c = userToManager.get(so.OwnerId);
	}
}
Test Class:
@isTest
private class ownerManagerTest {
	
	@isTest static void test_method_one() {
		// create a user, and populate his manager
		Profile myProfileId = [SELECT id
							     FROM profile
							    WHERE name = 'Standard User'
							    LIMIT 1];
			
		User u = new User(Alias = 'standt', Email='walidtestusers@walidtestorg.com', 
            EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
            LocaleSidKey='en_US', ProfileId = myProfileId.Id, ManagerId='0050Y000000Fm7z',
            TimeZoneSidKey='America/Los_Angeles', UserName='walidtestusers@walidtestorg.com');

		insert u;
		System.debug('1 No Opp yet, but User Manager ID: ' +u.ManagerId);

		Opportunity opp = new Opportunity (Name='Test Opp', CloseDate=date.TODAY(), 
			StageName='Prospecting', ownerID=u.Id);

		Insert opp;
		System.debug('2: OPP ownerID = ' +opp.ownerID +' should be = ' +u.Id 
						+' OPP ManagerId = ' + opp.Owner_s_Manager__c);

		System.assertEquals(u.ManagerId,opp.Owner_s_Manager__c, 'Not the same!');
	}
}

Manual testing succeeds, i.e, I when I create an opportunity from the UI, the field gets populated qithout any issue. But when performing the Unit Test, the assertion fails with the message

"System.AssertException: Assertion Failed: Not the same!: Expected: 0050Y000000Fm7zQAC, Actual: null
Stack Trace 
Class.ownerManagerTest.test_method_one: line 26, column 1"

What could be the issue?

Thanks.
Walid
  • January 29, 2017
  • Like
  • 0
Hi there,

I am new to Triggrs, and trying to bulkify the below Trigger. The Trigger will create a Task when stage is Closed Won. It will also check if the Opportunity already has a Task with the same Subject, and it won't create the tasks in this case.

The Trigger is:
trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {
	
    //create a list of tasks to be added
    List<Task> listTasks = new List<Task>();
    
    for (Opportunity opp : Trigger.New){
 		//create a list of Tasks already created with same subject on opp
        List<Task> existingTasks = [SELECT Id
                                      FROM Task
                                     WHERE WhatId = :opp.Id
                                       AND Subject = 'Follow Up Test Task'];
        
        //add new task only if stage is Closed Won and no existing task with same subject on opp
        if ((opp.StageName == 'Closed Won') && (existingTasks.size() == 0) ){
        Task newTask    = new Task();
        newTask.WhatId  = opp.Id; 
        newTask.Subject = 'Follow Up Test Task';
        newTask.Status  = 'Not started';
        newTask.OwnerId = opp.OwnerId;
        listTasks.add(newTask); 
        }
    }
    insert listTasks;
}
I want to move the SOQL query our of the For loop, but if I do it, it will look for Tasks with this subject throughout the whole Trigger.New opportunity list. How can I move it out and keep count of each opportunity having this task with this subject?

Thanks.
Walid
 
  • January 11, 2017
  • Like
  • 0
Hi there,

I am looking to share Opportunities that are owner by 2 Specfic users (User A and B) belonging to the same role, with another user (User X) in this same Role.

I tried to do that using Sharing Rules on the Opportunity object, but seems that I can only share Groups or Roles with other groups or roles, and nto specific users. 

Ho can I achieve that?

Thanks.
  • July 02, 2016
  • Like
  • 0
Hi there,

This is driving me crazy!

I am new to Salesforce, and I want to know how to prevent a user, say John Smith, who owns a record, say an opportunity, from transfering his record to another user. In other words, I don't want this user to see the link [change] next to the owner name, which is his name.
User-added image
I tried every possible combination without success:
- Field-Level security does not allow me to change to Read-Only
- Page Layout: Read-Only checked and Read-Only unchecked both give the sanme result: [change]  is still visible, 
- Profile permissions, I am using Standard User: the Transfer Record permission is unchked, Modify All Data also unchecked.
- No Permission Set given to t his user

The owner field ALWAYS shows the [change] link next to it, and the user can change the owner field.

Any solution?

Thanks.
 
  • June 14, 2016
  • Like
  • 0
Hi there,

I built a Visual Flow that finishes with calling an Apex method. The Flow is being launched from the Field Service Lightning mobile App, but when it tries to execute the Apex method, it fails with the error:
Error uploading: Irresolvable failure.
Invalid Action Type:
AP03c_sendToZuoraList
The Flow is a simple one that does some changes to the Work Order Line Item, and the last action is to call this method.

Here is how I am calling the method from within the flow:
User-added image

And here is the code of the method:
public class AP03c_sendToZuoraList {
    @InvocableMethod
    public static void SendToZuora(List<id> opportunityidList) {
         
        Id opportunityid = opportunityidList[0];
        
        List < zqu__Quote__c > zquotesList = [SELECT id, zqu__Opportunity__r.accountId, name, zqu__Customer_Acceptance_Date__c, zqu__Service_Activation_Date__c, zqu__SubscriptionName__c, zqu__BillCycleDay__c, zqu__ZuoraSubscriptionNumber__c
                                              FROM zqu__Quote__c
                                              WHERE zqu__Opportunity__r.id = : opportunityid];
        
        
        List<zqu.zQuoteUtil.ZBillingQuoteCollection> quotes = new List<zqu.zQuoteUtil.ZBillingQuoteCollection>();
        
        zqu.zQuoteUtil.ZBillingQuoteCollection quote = new zqu.zQuoteUtil.ZBillingQuoteCollection();
        quote.sfdcAccountId = zquotesList[0].zqu__Opportunity__r.accountId; // SFDC CRM Account ID
        quote.quoteRequests = new List<zqu.zQuoteUtil.ZBillingQuoteRequest>();
        for(zqu__Quote__c quoteToSend : zquotesList){
            zqu.zQuoteUtil.ZBillingQuoteRequest req = new zqu.zQuoteUtil.ZBillingQuoteRequest();
            req.sfdcQuoteId = quoteToSend.Id; // SFDC Quote ID
            quote.quoteRequests.add(req);
        }
        quote.zAccountId = 'new'; // Zuora Billing Account ID

        quotes.add(quote);

        List<zqu.zQuoteUtil.zBillingResult> results = zqu.zQuoteUtil.sendToZBilling(quotes);
        
        for ( zqu.zQuoteUtil.zBillingResult result : results ) {
            System.debug('Result: QuoteId = ' + result.sfdcQuoteId + ', Success = ' + result.success + ', message = ' + result.message );
        }
    }
}

Any suggestions?

Thanks!



 
  • August 24, 2018
  • Like
  • 0
Hi there,

I built a Lightning Component that is supposed to be launched from an Object Quick Action button. Unfortunately, the width of the Lightning Component is the default width of a quick action (50% I guess. How can I make the wodth of the component 100%?

I tried to add this to the cmp file, but the latest API doesn't allow the <Style> tag anymore in the cmp file:
 
<style>
       .slds-modal__container{
            max-width: 100% !important;
            width:100% !important;
       }
</style>

I also tried to add it to the CSS file:
.THIS .slds-modal__container{
           max-width: 100% !important;
           width:100% !important;
}

Did nto work either. 
Error:(1, 1) FIELD_INTEGRITY_EXCEPTION - Markup for markup://c:RegistrationForm may not contain a <style> tag: Source

How can I do that? 

Best,
Walid
  • June 06, 2018
  • Like
  • 0
We have a lightning component we use on (Lead) that is supposed to display different messages based on how 2 boolean fields are set.  We couldn't get the messages to display unless we put the fields on the page layout.  The permissions on the fields are read only for all profiles - so I don't see why they need to be on the layout for this to work.  (We have the same functionality in classic, works fine and the fields aren't on the layout).  Anyone else run into this or something similar?
Hi there,

I built a simple Lightning Component that display field of a record. The fields that I want to display in the component are all Formula fields, and I want to hide them in the Page Layout. When I hide them, the fields show as blank in the Lightning Component!! The only way to oversome this is to show the fields in the Page Layout.

Is there a way to show these fields in the Lightning Component and NOT in the Page Layout? 

Note that I am using the below to display the field in the component:
<div class="slds-col">
   <span>Deficiency<ui:outputRichText value="{!v.ConstRecord.Deficiency_Status__c}" /></span>
</div>

Thanks.
Walid 
  • May 24, 2018
  • Like
  • 0
Hi there,

I am testing a trigger with its test class:
trigger ownerManager on Opportunity (before insert, before update) {
	/*
	Write a trigger that populates an “Owner’s Manager” lookup field on opportunities 
	based on the opp owner’s (user’s) standard ManagerId field. 
	*/
	
	Set<Id> allUsersID = new Set<Id>();
	for (Opportunity so : Trigger.new) {
		//for each opportunity, get the owner's manager
		allUsersID.add(so.OwnerId);
	}

	List<User> users = new List<User>();
	users = [SELECT Id, ManagerId
			   FROM User
			  WHERE Id IN :allUsersID];

	Map<Id,Id> userToManager = new Map<Id,Id>();
	for (User us : users) {
		userToManager.put(us.Id,us.ManagerId);
	}

	for (Opportunity so : Trigger.new) {
		//for each opportunity, set the Owner's Manager Id to be the Owner's Manager from the Map
		so.Owner_s_Manager__c = userToManager.get(so.OwnerId);
	}
}
Test Class:
@isTest
private class ownerManagerTest {
	
	@isTest static void test_method_one() {
		// create a user, and populate his manager
		Profile myProfileId = [SELECT id
							     FROM profile
							    WHERE name = 'Standard User'
							    LIMIT 1];
			
		User u = new User(Alias = 'standt', Email='walidtestusers@walidtestorg.com', 
            EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
            LocaleSidKey='en_US', ProfileId = myProfileId.Id, ManagerId='0050Y000000Fm7z',
            TimeZoneSidKey='America/Los_Angeles', UserName='walidtestusers@walidtestorg.com');

		insert u;
		System.debug('1 No Opp yet, but User Manager ID: ' +u.ManagerId);

		Opportunity opp = new Opportunity (Name='Test Opp', CloseDate=date.TODAY(), 
			StageName='Prospecting', ownerID=u.Id);

		Insert opp;
		System.debug('2: OPP ownerID = ' +opp.ownerID +' should be = ' +u.Id 
						+' OPP ManagerId = ' + opp.Owner_s_Manager__c);

		System.assertEquals(u.ManagerId,opp.Owner_s_Manager__c, 'Not the same!');
	}
}

Manual testing succeeds, i.e, I when I create an opportunity from the UI, the field gets populated qithout any issue. But when performing the Unit Test, the assertion fails with the message

"System.AssertException: Assertion Failed: Not the same!: Expected: 0050Y000000Fm7zQAC, Actual: null
Stack Trace 
Class.ownerManagerTest.test_method_one: line 26, column 1"

What could be the issue?

Thanks.
Walid
  • January 29, 2017
  • Like
  • 0
Hi there,

I am new to Triggrs, and trying to bulkify the below Trigger. The Trigger will create a Task when stage is Closed Won. It will also check if the Opportunity already has a Task with the same Subject, and it won't create the tasks in this case.

The Trigger is:
trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {
	
    //create a list of tasks to be added
    List<Task> listTasks = new List<Task>();
    
    for (Opportunity opp : Trigger.New){
 		//create a list of Tasks already created with same subject on opp
        List<Task> existingTasks = [SELECT Id
                                      FROM Task
                                     WHERE WhatId = :opp.Id
                                       AND Subject = 'Follow Up Test Task'];
        
        //add new task only if stage is Closed Won and no existing task with same subject on opp
        if ((opp.StageName == 'Closed Won') && (existingTasks.size() == 0) ){
        Task newTask    = new Task();
        newTask.WhatId  = opp.Id; 
        newTask.Subject = 'Follow Up Test Task';
        newTask.Status  = 'Not started';
        newTask.OwnerId = opp.OwnerId;
        listTasks.add(newTask); 
        }
    }
    insert listTasks;
}
I want to move the SOQL query our of the For loop, but if I do it, it will look for Tasks with this subject throughout the whole Trigger.New opportunity list. How can I move it out and keep count of each opportunity having this task with this subject?

Thanks.
Walid
 
  • January 11, 2017
  • Like
  • 0
Hi,

I have added the Send an Email button in the Salesforce  Publisher but yet it is not showing in the list of actions on the Case Feed View.
User-added image

User-added image

As you can see above the button Send Email is missing despite of adding it on the Publisher Layout.

Please Help.

Regards,
Sagar
Hi there,

This is driving me crazy!

I am new to Salesforce, and I want to know how to prevent a user, say John Smith, who owns a record, say an opportunity, from transfering his record to another user. In other words, I don't want this user to see the link [change] next to the owner name, which is his name.
User-added image
I tried every possible combination without success:
- Field-Level security does not allow me to change to Read-Only
- Page Layout: Read-Only checked and Read-Only unchecked both give the sanme result: [change]  is still visible, 
- Profile permissions, I am using Standard User: the Transfer Record permission is unchked, Modify All Data also unchecked.
- No Permission Set given to t his user

The owner field ALWAYS shows the [change] link next to it, and the user can change the owner field.

Any solution?

Thanks.
 
  • June 14, 2016
  • Like
  • 0
Hello There.,

Am getting below error while completing the Marketing Dashboard challenge as part of Superbadge (Reports & Dashboards Specialist); i have also provided the screenshot of what i have completed. Spent couple of hours to understand where its breaking but couldn't get the cause of it. looking forward ..

error:The 'Marketing Manager' dashboard does not have the correct headers and titles for the chart components.

User-added image
Is it possible to enable multi-currency in a developer org? I know this requires sending a case, but since this is not an option within the developer instances I didn't know if there was another way to accomplish this.