I have a salesforce developer account on salesforce and
I am not able to delete mass EmailMessage.
I can see Task object and I can delete that but I want only email messages to delete.
Go to your name >Set up> Data Management> Mass Delete Records> Mass Delete Activities.>
Step 2: Find Activities that match the following criteria:>Subject Equals Email> Select checkbox that you want to delete > click Delete
Related
I have created a trigger in Salesforce :
Trigger myTestDelete_D on Account (before delete)
{
set<ID> ids = Trigger.oldMap.keyset();
myClass.Details('Account','delete',ids);
}
So the steps are I create an account Acct1.
I then delete the account , but in the call to myClass.Details I perform a select to the account with the id of the Acct1.
The issue is that the row has already been deleted and hence I get 0 rows.
Is there some sort of setting that is required in Salesforce to wait until the trigger has completed before the entity is deleted ?
I can't give you more details because we don't have the code of your "myClass" class but the query should retrieve the Accounts in the before delete trigger execution. I've created myself a trigger and set up some logs. Here are the results after deleting one Account record.
Trigger Code:
trigger Account on Account(before delete) {
System.debug(Trigger.oldMap);
System.debug(Trigger.newMap);
List<Account> deletedAccounts = [
SELECT Id, Name
FROM Account
WHERE Id IN :Trigger.oldMap.keySet()
];
System.debug(deletedAccounts.size());
}
System.debug(Trigger.oldMap):
{0013O00000kVO2PQAW=Account:{Id=0013O00000kVO2PQAW, IsDeleted=false, MasterRecordId=null, Name=My Account, Type=null, ParentId=null, BillingStreet=null, BillingCity=null, BillingState=null, BillingPostalCode=null, BillingCountry=null, BillingLatitude=null, BillingLongitude=null, BillingGeocodeAccuracy=null, ShippingStreet=null, ShippingCity=null, ShippingState=null, ShippingPostalCode=null, ShippingCountry=null, ShippingLatitude=null, ShippingLongitude=null, ShippingGeocodeAccuracy=null, Phone=null, Fax=null, AccountNumber=null, Website=null, PhotoUrl=null, Sic=null, Industry=null, AnnualRevenue=null, NumberOfEmployees=null, Ownership=null, TickerSymbol=null, Description=null, Rating=null, Site=null, OwnerId=0053O0000044sSdQAI, CreatedDate=2021-10-05 16:47:55, CreatedById=0053O0000044sSdQAI, LastModifiedDate=2021-10-05 16:47:55, LastModifiedById=0053O0000044sSdQAI, SystemModstamp=2021-10-05 16:47:55, LastActivityDate=null, LastViewedDate=null, LastReferencedDate=null, Jigsaw=null, JigsawCompanyId=null, CleanStatus=Pending, AccountSource=null, DunsNumber=null, Tradestyle=null, NaicsCode=null, NaicsDesc=null, YearStarted=null, SicDesc=null, DandbCompanyId=null, OperatingHoursId=null}}
System.debug(Trigger.newMap):
null
System.debug(deletedAccounts.size()):
1
So, I would suggest that the problem is probably in the class that is doing the Query as the records are still available for querying in the before delete trigger.
I am new to Snowflake and am trying to create my first task.
CREATE TASK task_update_table
WAREHOUSE = "TEST"
SCHEDULE = 'USING CRON 0 5 * * * America/Los_Angeles'
AS
INSERT INTO "TEST"."WEB"."SOME_TABLE" (ID,VALUE1,VALUE2,VALUE3)
WITH CTE AS
(SELECT
ID
,VALUE1
,VALUE2
,VALUE3
FROM OTHER_TABLE
WHERE ID NOT IN (SELECT ID FROM "TEST"."WEB"."SOME_TABLE")
)
SELECT
ID,VALUE1,VALUE2,VALUE3
FROM CTE
I got a message that the task was created successfully
"Task task_update_table successfully created"
I then try to run show tasks in schema SHOW TASKS IN "TEST"."WEB" and get 0 rows as a result. What am I doing wrong? why is the task not showing?
I did all of this under sysadmin and was using the same warehouse, db and schema.
There are some limitations around show commands that might be blocking you,
particularly "SHOW commands only return objects for which the current user’s current role has been granted the necessary access privileges".
https://docs.snowflake.com/en/sql-reference/sql/show.html#general-usage-notes
I suspect the task was created by a different role (therefore owned by a different role), or perhaps it was created in different database or schema.
To find it, I'd recommend running the following using a role such as ACCOUNTADMIN.
show tasks in account;
SELECT *
FROM (
SELECT *
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID())))
WHERE "name" = 'TASK_UPDATE_TABLE';
While testing and learning in Snowflake, it is critical you set your session "context" correctly, using commands like this:
USE ROLE my_role_here;
USE WAREHOUSE my_warehouse_here;
USE DATABASE my_database_here;
USE SCHEMA my_schema_here;
Doing those four commands, or setting defaults for them for your user will help you tremendously when learning.
I hope this helps...Rich
I want to get all the details respective to the table as mentioned in the title.
I tried, could get table name and view name but not all.
For Query:
sp_depends 'dbo.Employee'
For UI:
Right click table and View Dependancy
There are different ways to get it done.
Method 1:
sp_depends 'dbo.TableName'
GO
Method 2:
SELECT *
FROM information_schema.routines ISR
WHERE CHARINDEX('dbo.TableName', ISR.ROUTINE_DEFINITION) > 0
GO
Method 3:
SELECT referencing_schema_name, referencing_entity_name,
referencing_id, referencing_class_desc, is_caller_dependent
FROM sys.dm_sql_referencing_entities ('dbo.TableName', 'OBJECT');
GO
RIGHT CLICK ON DBNAME -->TASK--> GENERATE SCRIPT--> CLICK NEXT -->YOU CAN SELECT ALL OBJECT (TABLE,VIEW,SP,FUNCTION, ETC) --> NEXT --> CHOOSE BROWSE WANT TO SAVE SCRIPT -->CLICK NEXT -->CLICK NEXT-->CLICK FINISH
THEN OPEN YOUR LOCATION SCRIPT!
-->IF YOU WANT TO GET RECORD ALL DATA<--
RIGHT CLICK ON DBNAME -->TASK--> GENERATE SCRIPT--> CLICK NEXT -->YOU CAN SELECT ALL OBJECT (TABLE,VIEW,SP,FUNCTION, ETC) --> NEXT -->CLICK ADVANCE-->YOU ARE FIND 'TYPE OF DATA TO SCRIPT' IN TAB GENERAL, THEN CHANGE STATUS AT COMBOBOX TO BE SCEMA AND DATA-->CLICK OK-->CHOOSE BROWSE WANT TO SAVE SCRIPT -->CLICK NEXT -->CLICK NEXT-->CLICK FINISH
I have created Product entity in MDS.
It's having the following values:
Bike 1 ABC
Car 2 XYZ
Cycle 3 RRR
owner XYZ can change the record of RRR. But if owner XYZ or any other owner in this entity tried to update the ABC's record, access should be denied. That means, no one should have the permission to change the records which are entered by ABC.
for this I have executed following :
CREATE TRIGGER mdm.product_readonly
ON mdm.tbl_1034_1215_en
AFTER UPDATE, INSERT AS
If exists (system_user!='ABC')
and EXISTS (SELECT * FROM deleted a, inserted b, mdm.vw_product c
WHERE a.code=c.code
or b.code=c.code
And c.owner = 'ABC')
BEGIN
ROLLBACK TRANSACTION
RAISERROR ('Attempt to change a read-only row', 16, 1)
RETURN
END
After executing this, If I trying to update the record as ABC owner I can update all the records. If I try to update as other than ABC owner I couldnt update the ABC record. But from MDS I couldnt update any of the record. It showing like Database error.
How can we achieve this. Please help me out in this regard.
Thanks!
Please have a look on how to set permissions for MDS.
http://msdn.microsoft.com/en-us/library/hh231026.aspx
You can set permissions for users and/or groups.
I would recommend to assign permissions using AD groups as this is much easier to mantain on the long run.
If you need a more complex permission concept which is row based you can set permissions using derived hierarchies.
Permission settings are also stored in tables of MDSDB database. If you need to set permissions for many users I would recommend using code to copy permissiond. I can provide some snippets if needed.
I'm trying to create a loop to delete all portal rows. But the loop doesn't stop.
What am i doing wrong?
Go to Portal Row [Select; First]
Loop
Delete Portal Row [No Dialog]
Go To Portal Row [Next; Exit after last]
End Loop
I suspect that you have Allow creation of related records through this relationship on in your Relationships graph. This means that there will always be one record in the portal and that record can't be deleted because it is where a user would enter new data.
You could modify your script to something like this:
Go to Portal Row [Select; First]
Loop
Delete Portal Row [No dialog]
Go to Portal Row [Select; First]
Exit Loop If [IsEmpty(relationship::index)]
End Loop
Where relationship::index is a value stored in every field of your foreign table.
Manipulating portals like this can be tricky. You might consider using a Go to Related Records script step go delete the records, instead. Something like:
Set Error Capture [On]
#
# Attempt to go to the related records, creating a new window "delete records"
Go to Related Record [Show only related records; From table: "<relatedtable>"; Using layout: "<relatedlayout>" (<relatedtable>); New window]
#
# If that failed exit the script. We should still be in the same window and layout.
If [not Get ( LastError )]
Exit Script []
End If
#
# Otherwise delete all found records
Delete All Records [No dialog]
#
# And close the window we created
Close Window [Name: "delete steps"; Current file]
Set Error Capture [Off]