Process builder - salesforce

I created Contact Change event in Process Builder
Object: Contact
Criteria: Lastname change
Action: Apex
Here i am sending changed to contact id to my invocable apex class method
From that method i am creating an task for that Contact Change as an Activity with complete status
But there is Set Schedule section, i didn't configure for this section and i activated this Flow
I try to change my contact lastname as a new value but this trigger not working
Is it Set schedule section is necessary to trigger this workflow?
Or can i remove this option from workflow because i dont need that section.
I didn't see this Set Schedule section in workflow before, is it added as new one?
Can you suggest how to resolve this without Set schedule option?

Related

My custom object (detail end of a master detail relationship) is not showing up in the object field of the create record element of a flow

I have created a custom object called Onboarding and created a master detail relationship between it (detail) and the Account (master) object. It shows up fine in report builder and I have added it to the account page layout as a related list no problem.
I want to have a flow create records in the Onboarding object (related to an account), however, in the Create Record element, the Onboarding object is not available for selection in the 'Create a Record of this Object' field. I start with a 'Get Record' to get the account I want to use as Master, execute a screen element to gather some information, then want to do the create. What am I missing?

New to Azure Event Grid - trying to react to *any* object being created, deleted or modified

I'm completely new to Event Grid, but have been tasked with creating a way to track anytime any object is created, deleted, or modified within a subscription (additional noise filtering to be added later). Does this sound like I'm on the right track?
Logic App -> Workflow Designer:
When a resource event occurs:
Resource Type - Microsoft.Resources.Subscriptions
Resource Name - (subscription being watched)
Event Type Item - 1
Microsoft.Resources.ResourceDeleteSuccess
Event Type Item - 2
Microsoft.Resources.ResourceWriteSuccess
What I'm completely unclear on is how to output the object deleted/created/modified. Like write to a log or send an email "X" object was deleted by Y user. If anyone has a clue on that, I would greatly appreciate it. Or if there is an easier way to accomplish this, rather than using Event Grid, I'm open to suggestions.
WAY-1
Here is my Logic App flow
I'm using Outlook 365 Connector with Send an Email Action
The Event Data gives whole information on What, When and Who created/modified/Deleted the resource.
Here is the screenshot of the mail that I received.
you can add as many events as possible by clicking Add New Item
WAY-2
You can add logs to your storage account and check the details from there as below.
WAY-3
You can check it in the logs from Overview pane which gives complete details on particular Run Triggers.

How to start sql server extended events sessions using sql query

I am able to create SQL Server Extended events session using sql query.
But following are the two issues i am facing while creating Extended events session using sql query
Extended events session gets created in disabled(stop) state.
.xel file is not getting created at specified location.
I noticed while creating extended events using wizard initially extended event is created in disabled(stop) state and on selecting "Start event session immeditely...." session is set to start state and .xel file is created.
I want to implement this same step using sql query.
Following is my script
CREATE EVENT SESSION [LoginSession_History] ON SERVER
ADD EVENT sqlserver.connectivity_ring_buffer_recorded(
ACTION(sqlserver.client_app_name,sqlserver.client_connection_id,sqlserver.client_hostname,sqlserver.context_info,sqlserver.database_name,sqlserver.nt_username,sqlserver.plan_handle,sqlserver.query_hash,sqlserver.query_plan_hash,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text)),
ADD EVENT sqlserver.login(SET collect_options_text=(1)
ACTION(sqlserver.client_app_name,sqlserver.client_connection_id,sqlserver.client_hostname,sqlserver.context_info,sqlserver.database_name,sqlserver.nt_username,sqlserver.plan_handle,sqlserver.query_hash,sqlserver.query_plan_hash,sqlserver.server_instance_name,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text)),
ADD EVENT sqlserver.logout(
ACTION(sqlserver.client_app_name,sqlserver.client_connection_id,sqlserver.client_hostname,sqlserver.context_info,sqlserver.database_name,sqlserver.nt_username,sqlserver.plan_handle,sqlserver.query_hash,sqlserver.query_plan_hash,sqlserver.server_instance_name,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text))
ADD TARGET package0.event_file(SET filename=N'D:\Ext_Events\LoginSession_History.xel'),
ADD TARGET package0.ring_buffer
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON,STARTUP_STATE=ON)
GO
Use STATE = start; via altering the EVENT SESSION as next
-- Start the event session
ALTER EVENT SESSION test_session
ON SERVER
STATE = start;
GO
Reference from official site
To fix this , we need to use Alter event session command and pass STATE=start
Following is the link
https://www.concurrency.com/blog/december-2015/schedule-extended-events-session-start-or-stop
STARTUP_STATE=ON
Refers to the state that will used when the sqlserver service instance is restarted.
It determines whether it will be auto-started or not.
Whether to set ON|OFF depends on the type of event tracing you want to perform & whether you want it activate across recycles.
An invasive trace that consumes many cpu cycles whilst logging lots of detail would be very unwelcome at startup in most places.

In salesforce how to add a custom checkbox in pre-existing standard (E.g. User creation) page using Apex?

I want to create a salesforce app. That have trigger on user creation. I need to make it optional by including a checkbox on user creation page.(i.e : the trigger have to start only when my custom checkbox is selected).
How to add custom checkbox in "User creation" page programatically using Apex ?Is it possible or not ?
I tried with MetaData API as :
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
List<MetadataService.Metadata> fields = new List<MetadataService.Metadata>();
MetadataService.CustomField customField = new MetadataService.CustomField();
customField.fullName = 'User.custom_create_field__c';
customField.label = 'Custom created field';
customField.defaultvalue = 'false';
customField.sharingModel = 'ReadWrite';
customField.type_x = 'Checkbox';
fields.add(customField);
MetadataService.AsyncResult[] results = service.create(fields);\\trows session timeout error here
But the last line throws session timeout error. Am I going in correct way to achieve my need? If so how to solve session timeout error?
Why do you want to do this programmatically? What's the problem with adding the checkbox declaratively to the object and to the layouts?
By adding the field to the object metadata as you're doing here, you'll still need to manually add it to layouts to ensure it's available for users to check or uncheck on your user creation page. Adding a new field to all custom layouts is not a trivial exercise, believe me!
However, if you still want to go ahead with this, you should try a different approach. It looks very much to me as though you've taken inspiration from Andy Fawcett here:
https://andyinthecloud.com/2013/10/27/introduction-to-calling-the-metadata-api-from-apex/
You should see the IMPORTANT UPDATE section. The async Metadata API methods were deprecated some time ago, this is the pattern to follow now:
https://andyinthecloud.com/2014/08/14/apex-metadata-api-streamlined-and-simplified-for-summer14/

Concurrent update on record in Salesforce

In system I am developing, user can access particular page which is used to make DML operation on custom object. I want to fulfill following business case :
User A opens a Page made changes on page but did not click Save.
At the same time User B opens a page made changes and click Save. User B data got saved in record.
Now user A came and click Save. But as data is outdated I want to prompt user that "you are over righting the latest update. Do you want to continue."
Is there any faster out-of-box way available to achieve it ?
Assuming this is in a VisualForce page, you could check if the value has changed inside your Save method.
Query for the LastModifiedDate of all records you may change, and save that in your controller. This should be done in your controller's constructor and/or anywhere you re-load the record(s).
In the save method, first query the record(s) again to check if the LastModifiedDate has been changed. If it has been changed, prompt the user.
Assuming you are trying to insert a record into an object.
You can write a validation rule on that object. Check if that record is already inserted or not and show an error message.
Regards,
Naveen
autorabit

Resources