Lookup filter Question -- Tricky One (Lightning) - salesforce

Its a tricky situation fail to get it. i am a newbie in SF. Here is the scenario --
There is a lookup filter on Product Interest field &
Product Brand is a PickList
what's happening is that out of 6 picklist values for Product Brands only one is causing Lookup functionality to fail i.e Products corresponding to that particular brand do'not show up in Product Interest field.
-Show All does nothing,
-Typing related values (from Workbench) does nothing,
-Adding a new product does not register new product with that particular brand.
-tried comparing WorkBench data with other brands no conclusion still
Any clues y'all might be able to provide. Thank you so much in advance.
Regards,
Sunny

Some screenshots would help to understand your issue...
Data visibility
Are you sysadmin? If not - maybe there are matching rows but sharing rules prevent you from seeing it. Does it show the records in the lookup OK when you change the filter from mandatory to optional?
Data quality
Are you sure there are no typos, that the brand picklist on the record you're creating / modifying is identical to the brand picklist (or whatever it is) on product? Don't look at the label (what's shown in the UI), look at picklist value (what's actually stored in the database). Labels can be translated to other languages but filters and custom code compare values.
Other debugging ideas
Is it a standard create/edit screen or a custom component? If needed - would you know how to run the standard create screen and/or go to Classic UI?
Can you import a record bypassing the UI. Ask admin how to use Data Import Wizard, Data Loader or maybe programmer could help you with piece of code to run in developer console. Something like
MyObject__c o = new MyObject__c(
ProductBrand__c = 'Problematic',
ProductInterest__c = '01t....' // the Id of product you hope to see in the lookup that has same "Problematic" picklist value
);
insert o;
System.debug(o.Id);
Maybe it'll work, maybe it'll throw you an error that will help investigating.
Do you have record types on the object, maybe the problematic picklist value is not legal for the record type you're using and you'd need to allow it first.
Can you reverse the create action. Like go to Product layout editor, add a related list of "MyObjects" (or whatever it is you're inserting) and try to create using the "New" button on the related list. Hopefully that should come with the product preselected in the lookup or show you some error.

Related

Saleforce Admin Sharing Rule

[Note: There is a Teacher Object with the fields such as Teacher Name, DateofJoining, and also a formula field called Experience]
My Task was to create a Public Group consisting of another user
and this user should only see teachers who have experience greater than 2 years
But when i create a sharing rule based on criteria the field name called Experience doesn't show up as it is a formula field.
So i got an idea of creating a new field(maybe a text or number data type) which would have the value of Experience in it. (But i have no idea on how to implement this)
Is there a way to implement this?
Any other solution is also well appreciated!
Hard to say.
Normal trick would be to create a helper field (text, number, whatever) and have piece of functionality that populates it. An "early flow" or "before insert, before update" trigger ideally. Worst case a normal flow, process builder or "after insert, after update" trigger. Something like "if Experience__c != 'your formula here' then Experience__c = 'your formula here'". Consult normal SF help and trailhead if you never used early flows
You'd make an one-off data fix to populate existing records and job done, normal field should be selectable as sharing rule criteria.
=====
But I smell trouble with your formula. What exactly you have there, something like Experience__c = (TODAY() - DateofJoining__c) / 365? That's bit evil. Formulas with TODAY(), NOW() or anything with $ (roughly speaking who's looking at the data, user's name, profile role... not what's actually on the record itself) are "nondeterministic". Unpredictable.
A "today()" changes just like that, without updating the record. Sure, when you watch the record a fresh value will be calculated but other than that LastModifiedDate doesn't change, there's no magical trigger running at midnight that rechecks sharing. (especially that there's no single midnight, you could have users in multiple timezones). SF just doesn't allow nondeterministic fields in many places, see https://salesforce.stackexchange.com/q/32122/799
So if you do rely on TODAY() in your formula you might have to make a "scheduled flow" or read about schedulable, batchable apex. Create nightly job that would run and recalculate your helper field with right experience. You'd probably even need both solutions, a "before save" flow for new data created today and nightly job to advance the clock on existing old data...

Azure form-recognizer - prebuilt-invoice doesnt recognize currency, other custom fields

Azure form-recognizer, prebuilt-invoice doesnt recognize currency and some of my other custom fields from my invoice pdf. General Document gets me all key values. But for General document keyvalues I need to write algorithm to categorize the invoice related fields, which are already done in prebuilt-invoice.
I need all keyvalues from prebiult-invoice api, so I can find the missing elements by myself.
Anybody faced this? how do you overcome? one way I think of is, we can call both apis for same document. But it affects performance and increases cost.
any suggestion?

Salesforce: How to have user select multiple Products and have them assign it to a single Opportunities?

Product is related to Parts thru a junction object 'ProductPartUse' so its Product -> ProductPartUse <- Part. I want the user to select multiple Parts and lookup to a single Product and have all Parts be assigned to the Product thru the Junction Object ProductPartUse. I think we may have to use a visual force page or a lightning component with Apex code to accomplish this. If someone can help point to some existing sample code or help me get started. Thanks
You do not need to write custom code in VF/Aura/LWC. This can be accomplished using standard functionality with ProductPartUse sObject having two master-detail relationships (one to Product and one to ProductPartUse). The interface would not be as easy for the user, because they would need to do one ProductPartUse record at a time. If you want to have one screen where they can simultaneously select multiple parts and associate it with a product, then yes... you do need custom code. I would suggest you build it using LWC because the other 2 technologies are old (not deprecated, but not as cool). But if you are not comfortable with code, then look into flows.

Created Custom objects on salesforce not showing up under Leads

I have custom object 'Subject_c' with 3 fields and I have created those objects by uploading a CSV file. Subject_c has a lookup relationship with Leads (Its general for the same user regardless of what lead he is viewing). I am able to insert a related list and I can see that the objects are created under Data Management/Storage Usage. But it shows blank under related list.
You're saying that the custom object has lookup to Lead but then you say Subjects are generic and somehow should be displayed on every Lead page? I don't think it'll work.
Stuff appears on related list only when field Subject_c.Lead_c will be populated with "this" Lead's Id. (please note I've made best guess at the field name). So you'd need to insert separate data for each Lead which can quickly blow your storage usage and will be a pain in the a$$ to maintain later. Is it only for displaying? Or do you plan to later capture some kind of survey results for each Lead?
If it's just for display I think you'll need to embed a Visualforce page in the Lead page layout to achieve that in a saner way. The subjects are specific to current viewing user? Or it's more like a general list, just 3 subjects for whole organisation?
P.S. "object" is like a table in normal database. I think you mixed a bit the difference between table and records / rows of data stored in it.

Viewing a "log" of new (distinct) events in a database

I have an application which has several unrelated tables in its db. I'll explain by using an "auto-updating" version of the SO homepage as an example, so lets say I have the tables "users", "comments" and "questions".
The homepage client side needs to periodically poll the server, and get a log of all the new "events" that have happened. I.e., I'd like to display (somehow) the new questions, comments and users that have been added to SO since the last poll.
On way would be to simply keep a variable on the client side containing the last index of each of my tables, send it to the server, and have the server send me the new users, comments and questions.
The problem is, what happens when I add a new type of information, say, votes. Now I have to store another variable on the client-side, and the server has to poll another table. And so on, for every new type of information I keep.
I'm looking for a solution that helps me avoid this.
Another problem - say I'd like to see all the "events" that have happened since last time, but sorted according to when they took place.
One direction I had is to have a single "events" table, which contains the info about when each event happened. I can then poll only this table, and get a list of all the new events that have happened. The problem is that each event is pretty different (a new comment has different columns than a new upvote, etc.) So I'm not sure how to implement this, or if this is even a good idea.
Does anybody have any ideas how I can solve this? This seems like something that would come up a lot, but I don't really have much experience with databases, unfortunately.
Thanks!
It sounds to me like you're trying to future proof via database design. While this can be done through something an EVA model I caution against that because the value its adds tend to not be worth the cost.
Instead you should model the database as closely to reality as possible and not how you intend to use it.
Then use SQL to project the data to how you need it. You can do this by statements that will either deliver the meta data that you need
e.g.
Select
Count(ID) , 'Comments' Type
From
Comments
Where
lastUpdate > #InputParamter1#
UNION Select
Count(ID) , 'Questions' Type
From
Questions
Where
lastUpdate > #InputParamter1#
Or (and this doesn't get used Often enough)
Return more than one result set from your database in one go
Select
userid,
ComentText
From
Comments
Where
lastUpdate > #InputParamter1#;
Select
userId,
Questions,
Tags
From
Questions
Where
lastUpdate > #InputParamter1#
That said you will still have to write some code if you add new stuff but it should be limited to updating your sql, adding new containers for your data and then code to display to the end users and then to validate and store it.
Honestly the idea of adding new stuff requiring some work doesn't seem that awful to me.

Resources