content type not listed in drupal views - database

Trying to reset up a view in Drupal 7.18 for data in profile2 but when go to add content type, the profile type content is not listed to add.
I think I may have broken the table regarding this because it was working before I changed something and views reported something missing but still showed alright in preview of view but not on page of view where it just showed index list. I tried to fix things by deleting the view and starting again but as I said, profile 2 content type won't even show up.
Is there a way around having to restore with full backup because my last backup I've just realised included this error. Is there a way to repair or import just the profile 2 table (from another backup )?

If it is a 'user' view type, you may have to set up a relationship.

you need to create a view of "Profile Types".

Related

Changing Page type via Wagtail admin

I can choose Page type (Page model) in Wagtail admin on creation. This feature is documented: http://docs.wagtail.io/en/latest/editor_manual/new_pages/selecting_a_page_type.html
Is it possible, though, to alter page type in Wagtail admin after the page was created? And is there a way to alter page type programmatically?
There is no way to alter the page type after it is created using the admin panel in my best knowledge. I have encountered the same problem and I manage to solve it by editing database entry. I am not sure that is the right thing to do or not.
I have mistakenly made a page ('StandardPage' instead of 'StandardIndexPage') and I want to correct it. I can't delete and recreate this page as it has another tree structure below it. So I follow the following steps to change page type.
Select the page you want to change and find out its id. Just click on edit then it will open a page like localhost:8000/admin/pages/120/edit/. The number shown will be your id.
Select any page which is the type you want to change your page. Then get the id of it.
Go to 'wagtailcore_page' table and see the 'content_type_id' of both pages.
Double check the content type is correct or not in 'django_content_type' table.
Go to the database and check the entries for it in an appropriate table in my case 'home_standardpage'. Double check everything.
Go to the new class table where you want to move (home_standardindexpage) and check the requirements. Add an entry with your page id(120 for the above example). Then save the entry.
Go to the 'home_standardpage' and delete the entry which you don't want any more(id=120) in the above case.
Finally, go to the 'wagtailcore_page' table and find the id (120) and change the 'content_type_id' field to the new page type.
Then that will change your page type. Please take extra care as you are editing in a database. First try it in local replica then only change it in the real product.

Get content Id (nid) from path on views block

I just can't seem to wrap my head around Drupal relationships. I have been reading and watching tutorials, but as soon as I try to get my own project done - I fail. I think it's very basic, so I would love to understand it. Maybe someone here can help me understand how it works :)
On my drupal site, I want to keep track of some private game tournaments.
I have created a content type called contestant, which has fields like: Tournament date, Player name, Final Position. I can then create a view that list the information from one tournament. I used the help I got from this thread: drupal views dynamic filter
I would like to have the view described above as a block. And then place that block-view on a "tournament description" page. I could do this, by simply creating a new block each time, and then manually place it on the page it should be shown (structure-->Blocks-->configure), but that is not an elegant way to do it. I am pretty sure this is where Relationships should be used. But I fail to understand how to create this relationship, so that the specific block view, that matches the specific tournament description page will be displayed together.
Use a Content:Nid as a Contextual filter.
WHEN the Filter value is not in the URL >>
Provide default value
Content ID from URL

How to change columns in a SharePoint external content type without screwing everything up?

SCENARIO 1:
I have a SQL Server stored procedure that returns rows/columns. Then in SP Designer (SPD) I create an external content type (ECT) and push to Central Admin (CA). In CA, I assign permissions. On the site, I create an External List (EL) and can view my data. All good.
I change a column name from "Vendor Name" to "Vendor in the procedure. Now I go into SPD to alter the ECT and SOMETIMES it cannot be opened, giving an error:
"The BDC Service application Business Data Connectivity Service is not accessible. The full exception text is: Xml type 'List of xdt:untypedAtomic' does not support a conversion from Clr type 'Guid' to Clr type 'String'."
I didn't see what that had to do with my changes. Undoing my change to the procedure didn't resolve it. I had to delete the ECT and ET and recreate them. However, it sometimes happened again.
SCENARIO 2
While testing to see if it happened again, I discovered it sometimes did not. I had different problems.
After renaming the field in the proc, I went into SPD and successfully opened the ECT and made changes, pushing it CA. In CA, I discovered all permissions had been removed. This is a problem. Why does this happen? How to avoid?
So I redo permissions, then go to the site, where two different "sub" problems occur.
SCENARIO 2 A
The External List is broken and cannot be viewed or updated to show the new column name. I have to delete the list and recreate it. This obviously kills any views and removes it from every page where it was, etc., or anything referencing it. This is a nightmare. How to avoid this? I thought of one way, leading to....
SCENARIO 2 B
Instead of creating an External List, I edited a web page, added a Business Data List (BDL) web part and added my ECT to it. Everything was fine. I then purposely renamed a column in the proc again, opened SPD and (this time) was able to open the ECT, updating the field name. I pushed to CA. All permissions were removed (sigh). I re-added them. Then I went to my web page with my BDL, which was broken. I edited the web part and was able to update it so that data appeared onscreen.
BUT, the old "Vender Name" field was missing (no surprise as I'd renamed it). But the new "Vendor" field was also missing. In the BDL web part, I edited the view, discovering to my surprise that NEITHER field was in the list of fields that could be added to the view. In SPD, I opened the ECT to verify the new field was there (it was). No amount of pushing the ECT to CA, redoing permissions, and editing the BDL resulted in the new field appearing. Then, finally, somehow, the new field appeared onscreen without me ever adding it to the BDL view - caching issue?
THE QUESTION
So now I'm left with two questions:
1. Can you use a External List and avoid the problem above?
2. Why do permissions disappear every time the ECT is updated and how to prevent this?
Thanks.
for Scenario 1: Sharepoint is not cool with the "GUID" datatype. Before committing the change to your ECT, breadcrumb back one level to the ECT (sharepoint will alert you if you're going "too far back" and might lose your changes) and check the datatypes that sharepoint has assigned to each field, if you notice any GUID datatypes, you may have to manually coerce them to varchar in your view/proc and close/reopen the ECT.
Scenario 2: This is likely a timing issue and has happened to me before. What happened is that you created you ECT in designer and saved it, then went to CA to set permissions. if you had no reason to re-update your ECT you would have been all good. But the problem was that you needed to make a change AFTER setting the permissions but probably had left the newly created ECT open in designer. So what you have to do is this - after setting the permissions in CA, DO NOT SAVE ANY CHANGES TO THAT ECT UNTIL YOU VERIFY THAT YOU SEE THE PERMISSIONS YOU SET IN CA IN DESIGNER (this is the box in the upper right). This is the problem : SP designer doesnt let you SET permissions but will HAPPILY override them when saving, so if you see no permissions in designer, then saving that ECT will "reset" the permissions to empty. After setting permissions in designer, you have to wait/refresh (sometimes close and re-open the ECT) the ECT in designer until you see the permissiosn there as well.
Scenario 2B: often making changes to ECTs have to let them "propagate" through to the site (this is just how I envision it, i didnt read this). After making changes I've seen my ECTs break completely (you'll get a correlation ID error that wont be useful) or just not seeing my changes. The solution is "Smoke if ya got em". I usually wait at least 10 minutes after making an update until I start being concerned if the ECT is broken, not displaying my change, etc.
Hope this helps!

Show custom object in related list under page layout

I have been trying this whole day but cant figure out... I have custom object called Dev which has many to many relationship with Accounts... I want this object Dev to show under related list of page layout of account... But it is not showing there how can i add that to related list?
Assuming you have a lookup relation from Account to Dev and also a lookup from Dev to Account (creating your many-to-many), then this will work fine.
Try re-creating your lookup relationship from Account to Dev. Then make sure that you add the related list and add to the page layouts in steps 5 & 6:
Step 5. Add reference field to Page Layouts (Yes to All)
Step 6. Add custom related lists (Yes)
That's all you need. If, however, your many-to-many relationship is unique or otherwise configured differently (with a junction table, for example) then the above may not work for you.
We always tend to use joining objects for these relationships, obviously you can show the list of joining objects as a related list, and you could display other fields from the dev object by use of formulae.
One thing we've tended to do is create an inline VF page which can then show all of the objects related to the current record.

Where do I add a trigger for "Notes and Attachments" in salesforce.com?

I cannot find where in the salesforce.com UI I can add a trigger on a file attachment. I can find triggers on almost everything else, but attachment seems to be missing from the list (even when I view source on the page and search it. Does anyone know WHERE I can put this trigger in?
There is no way to do it directly as Attachment is one of those "lesser" objects that salesforce really gets "protective" about in a random and biased way. The only "legit" way to do it is to use some external build&deploy tools such as Force.com IDE.
If however you are not a stranger to undocumented 'hacks' do the following. Go to any object's trigger list and click create new. In the URL locate entity query string parameter (e.g. entity=Case) and change it to Attachment (entity=Attachment) and press Enter. Newl loaded screen will accept Attachment trigger.
Using Eclipse (Force.com IDE plug-in), right-click on your project & select "New" > "Apex Trigger". In the dialogue window that pops up, there is an "Object" dropdown / picklist, choose the object you want from this list - "Note" or "Attachment" etc. - then choose the "events" you want to trigger to execute on.
NOTE: a best practice is only one (1) trigger per object since you cannot guarantee the order in which multiple triggers on the same object will execute.
Have you tried creating the trigger from, force.com IDE??
In my opinion it should be possible from there.
To write a trigger for attachment, there is no straight way to do it but you can do it.
By creating a trigger on other object for example create a trigger in contact object then the url of the current page shows
"https://ap1.salesforce.com/........./&entity=Contact" you have to change "entity=Attachment"
then the trigger will be created for attachment object.

Resources